Command
df.sort_valuesExplanation
df.sort_values() sorts rows by column values, while df.sort_index() sorts by index.
Examples
Sort by column col1 ascending
df.sort_values("col1")Sort by column col1 descending
df.sort_values("col1", ascending=False)Sort by index
df.sort_index()