use mean over groupby as dataframe code example Example: pandas groupby mean df.groupby(['A', 'B']).mean()