Get the first value of the sub-lists
Description
Get the first value of the sub-lists
Usage
<Expr>$list$first()
Value
A polars expression
Examples
library("polars")
df <- pl$DataFrame(a = list(3:1, NULL, 1:2))
df$with_columns(
first = pl$col("a")$list$first()
)
#> shape: (3, 2)
#> ┌───────────┬───────┐
#> │ a ┆ first │
#> │ --- ┆ --- │
#> │ list[i32] ┆ i32 │
#> ╞═══════════╪═══════╡
#> │ [3, 2, 1] ┆ 3 │
#> │ null ┆ null │
#> │ [1, 2] ┆ 1 │
#> └───────────┴───────┘