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