GroupBy#

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

GroupBy.__iter__()

Allows iteration over the groups of the group by operation.

GroupBy.agg(*aggs, **named_aggs)

Compute aggregations for each group of a group by operation.

GroupBy.all()

Aggregate the groups into Series.

GroupBy.apply(function)

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

GroupBy.count()

Return the number of rows 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.len()

Return the number of rows in each group.

GroupBy.map_groups(function)

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

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.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.