Example

In this example we group by the state column then the gender column, and we count the names (a proxy for counting the number of rows), we find the max age for each grouping, and we calculate the average balance. We suppress the aggregation text on the balance column because we want to format as currency...but that means that we can't easily see that it's an average.

We write a function that extracts the aggregated data for states and genders (if you change the grouping then this function will stop working), and writes them to the console.