Get the first value of the sub-arrays
Description
Get the first value of the sub-arrays
Usage
<Expr>$arr$first()
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(first = pl$col("a")$arr$first())
#> shape: (2, 2)
#> ┌───────────────┬───────┐
#> │ a ┆ first │
#> │ --- ┆ --- │
#> │ array[i64, 3] ┆ i64 │
#> ╞═══════════════╪═══════╡
#> │ [1, 2, 3] ┆ 1 │
#> │ [4, 5, 6] ┆ 4 │
#> └───────────────┴───────┘