sort grouped.mean() pandas dataframe code example Example: pandas groupby mean df.groupby(['A', 'B']).mean()