pandas sort column index ascending code example Example: pandas sort dataframe by index df.sort_index()