polars.internals.lazyframe.groupby.LazyGroupBy.agg#

LazyGroupBy.agg(aggs: Union[Expr, Sequence[Expr]]) LDF[source]#

Describe the aggregation that need to be done on a group.

Parameters:
aggs

Single / multiple aggregation expression(s).

Examples

>>> (
...     pl.scan_csv("data.csv")
...     .groupby("groups")
...     .agg(
...         [
...             pl.col("name").n_unique().alias("unique_names"),
...             pl.max("values"),
...         ]
...     )
... )