Skip to content

Aggregate values into a list

Description

Aggregate values into a list

Usage

<Expr>$implode()

Value

A polars expression

Examples

library("polars")

df <- pl$DataFrame(a = 1:3, b = 4:6)
df$with_columns(pl$col("a")$implode())
#> shape: (3, 2)
#> ┌───────────┬─────┐
#> │ a         ┆ b   │
#> │ ---       ┆ --- │
#> │ list[i32] ┆ i32 │
#> ╞═══════════╪═════╡
#> │ [1, 2, 3] ┆ 4   │
#> │ [1, 2, 3] ┆ 5   │
#> │ [1, 2, 3] ┆ 6   │
#> └───────────┴─────┘