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