Skip to content

Use_iloc

Documentation Index

Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt

Use this file to discover all available pages before exploring further.

Use the .iloc attribute for index-based selection

df: pandas.DataFrame
data = df[1]
df: pandas.DataFrame
data = df.iloc[1]

Using ‘iloc’ is optimized for selecting data in Pandas based on index position (https://pandas.pydata.org/pandas-docs/stable/user_guide/10min.html#selection). This rule replaces the generic indexing with ‘iloc’ for index-based selection.

data = df[5]
data = df.iloc[5]