At times the data aggregation we wish to perform involves applying the same data aggregation operation to multiple columns. Implicit Aggregation is a data manipulation pattern that allows us to succinctly apply one or more data aggregation expressions to a selected set of columns without having to spell out each operation explicitly.
In its simplest form, a typical implicit data aggregation expression looks like so:
df_2 = df.groupby('col_1')[['col_2', 'col_3']].agg('sum')
where we group the data frame in the desired way, then select the columns that we wish to aggregate and then use agg()
to execute one or more data aggregation operations on each of the selected columns.
This section is organized to cover the aspects of Implicit data aggregation as follows: