add sort = true in map of a dataframe code example Example: pandas concat and reset index train_df = pd.concat(train_class_df_list, ignore_index=True)