An aggregation function can be applied to each group using the .aggregate() (or in short, .agg()) method of the GroupBy object. The parameter of .agg() is a reference to a function that will be applied to each group. In the case of a DataFrame, this function will be applied to each column of data within the group.
The following example demonstrates calculating the mean of the values for each sensor and axis:
As .agg() will apply the method to every column in each group, pandas also calculates the mean of the interval values (which may not be of much practical interest).
The result of the aggregation ...