# Several Summaries at Once: agg

agg works out several summaries for each group in one table, from a list such as \['sum', 'mean', 'count'\] or by named aggregation, which names each new column and the column and summary it comes from; groupby takes a list of columns to group by two things at once, and reset_index or as_index=False turns the group labels back into ordinary columns.

![Cheat sheet: Several Summaries at Once: agg](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/b02f8d63959f4a47a85c7c1e65864bdd.webp)

- Category: Data Analysis
- Level: Journeyman
- Tags: agg(), MultiIndex, Named Aggregation, python, reset_index()
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/pandas-groupby-agg-cheat-sheet
