Get the last value of the sub-arrays
Description
Get the last value of the sub-arrays
Usage
<Expr>$arr$last()
Value
A polars expression
Examples
library("polars")
df <- pl$DataFrame(
a = list(c(1, 2, 3), c(4, 5, 6))
)$cast(pl$Array(pl$Int64, 3))
df$with_columns(last = pl$col("a")$arr$last())
#> shape: (2, 2)
#> ┌───────────────┬──────┐
#> │ a ┆ last │
#> │ --- ┆ --- │
#> │ array[i64, 3] ┆ i64 │
#> ╞═══════════════╪══════╡
#> │ [1, 2, 3] ┆ 3 │
#> │ [4, 5, 6] ┆ 6 │
#> └───────────────┴──────┘