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