Pandas groupby agg: Applying multiple aggregations at once

Pandas groupby agg: Applying multiple aggregations at once

Apply multiple aggregations when grouping on a Python Pandas data frame with agg:

df.groupby('country')['sales'].agg(['mean', 'std'])

Grouping on 2+ columns? Each method will be applied to each column:

df.groupby('country')[['sales', 'revenue']].agg(['mean', 'std'])