GroupBy#

This namespace is available after calling DataFrame.groupby(...).

GroupBy.agg(aggs)

Use multiple aggregations on columns.

GroupBy.agg_list()

Aggregate the groups into Series.

GroupBy.apply(f)

Apply a custom/user-defined function (UDF) over the groups as a sub-DataFrame.

GroupBy.count()

Count the number of values in each group.

GroupBy.first()

Aggregate the first values in the group.

GroupBy.head([n])

Get the first n rows of each group.

GroupBy.last()

Aggregate the last values in the group.

GroupBy.max()

Reduce the groups to the maximal value.

GroupBy.mean()

Reduce the groups to the mean values.

GroupBy.median()

Return the median per group.

GroupBy.min()

Reduce the groups to the minimal value.

GroupBy.n_unique()

Count the unique values per group.

GroupBy.pivot(pivot_column, values_column)

Do a pivot operation.

GroupBy.quantile(quantile[, interpolation])

Compute the quantile per group.

GroupBy.sum()

Reduce the groups to the sum.

GroupBy.tail([n])

Get the last n rows of each group.