polars.internals.frame.GroupBy.agg_list¶
- GroupBy.agg_list() polars.internals.frame.DF ¶
Aggregate the groups into Series.
Examples
>>> df = pl.DataFrame({"a": ["one", "two", "one", "two"], "b": [1, 2, 3, 4]}) >>> df.groupby("a").agg_list() shape: (2, 2) ┌─────┬────────────┐ │ a ┆ b │ │ --- ┆ --- │ │ str ┆ list [i64] │ ╞═════╪════════════╡ │ one ┆ [1, 3] │ ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤ │ two ┆ [2, 4] │ └─────┴────────────┘