sort the withindex dataframe