Sorting

Sorting reorders the rows of a DataFrame with sort_values() by one or more columns, in ascending or descending order, and sort_index() by the index. The ascending argument can be a list for different directions per column. Missing values are placed at the end by default.

Example

df.sort_values(['pays', 'ca'], ascending=[True, False])

Related concepts

The whole glossary