Skip to content
masterclass Buddy

Pandas · Function

df.sort_values

Sort a DataFrame by one or more columns, or sort labels along an axis. You can control direction, missing values, index labels, and the values used for comparison.

Last updated

Syntax

DataFrame.sort_values(by, *, axis=0, ascending=True, inplace=<no_default>, kind='quicksort', na_position='last', ignore_index=False, key=None)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • DataFrame.sort_index
  • Series.sort_values

Source: pandas.DataFrame.sort_values — pandas 3.1.0 documentation. Checked 2026-11-03.