pandas and NumPy 3 · Selecting and filtering

Get the top rows

Return the five rows with the largest values.

df.nlargest(5, "revenue")

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?