GroupBy#

This namespace comes available by calling LazyFrame.group_by(..).

LazyGroupBy.agg(*aggs, **named_aggs)

Compute aggregations for each group of a group by operation.

LazyGroupBy.all()

Aggregate the groups into Series.

LazyGroupBy.apply(function, schema)

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

LazyGroupBy.count()

Return the number of rows in each group.

LazyGroupBy.first()

Aggregate the first values in the group.

LazyGroupBy.head([n])

Get the first n rows of each group.

LazyGroupBy.last()

Aggregate the last values in the group.

LazyGroupBy.len([name])

Return the number of rows in each group.

LazyGroupBy.map_groups(function, schema)

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

LazyGroupBy.max()

Reduce the groups to the maximal value.

LazyGroupBy.mean()

Reduce the groups to the mean values.

LazyGroupBy.median()

Return the median per group.

LazyGroupBy.min()

Reduce the groups to the minimal value.

LazyGroupBy.n_unique()

Count the unique values per group.

LazyGroupBy.quantile(quantile[, interpolation])

Compute the quantile per group.

LazyGroupBy.sum()

Reduce the groups to the sum.

LazyGroupBy.tail([n])

Get the last n rows of each group.