pandas and NumPy 3 · Selecting and filtering

Select by position

Select the first five rows and first two columns by position.

df.iloc[:5, :2]

Official pandas and NumPy 3 documentation

More selecting and filtering commands

All selecting and filtering commands · pandas and NumPy 3 cheatsheet

Was this page helpful?