pandas and NumPy 3 · Selecting and filtering

Sort rows

Sort by one or more columns.

df.sort_values(["country", "age"], ascending=[True, False])

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?