loc and iloc in Python
From the Pandas cheat sheet ยท Select Rows and Columns ยท verified Aug 2026
loc and iloc
Select by labels or integer positions.
python
df.loc["ana", "score"]
df.iloc[0, 1]๐ loc uses labels and iloc uses positions
๐ Label slices include the stop label
โก at and iat optimize scalar access
๐ฏ Use explicit indexers in reusable code
locilocselection
Continue with Pandas
Save the full cheat sheet or work through every related task.