pandas group by and find mean and name the column code example Example: pandas groupby mean df.groupby(['A', 'B']).mean()