AggregationΒΆ

Aggregation functions take a partition_by and filter keyword argument. The partition_by argument can only be given when used within mutate. If a partition_by argument is given and there is a surrounding group_by / ungroup, the group_by is ignored and the value of partition_by is used.

Warning

The filter argument works similar to Expr.filter in polars. But in contrast to polars, if all values in a group are null or the group becomes empty after filtering, the value of every aggregation function for that group is null, too.

count

Counts the number of non-null elements in the column.

all

Indicates whether every non-null value in a group is True.

any

Indicates whether at least one value in a group is True.

max

Computes the maximum value in each group.

mean

Computes the average value in each group.

min

Computes the minimum value in each group.

sum

Computes the sum of values in each group.

str.join

Concatenates all strings in a group to a single string.