Get the index of the maximal value in list
Description
Get the index of the maximal value in list
Usage
<Expr>$list$arg_max()
Value
Expr
Examples
library("polars")
df = pl$DataFrame(list(s = list(1:2, 2:1)))
df$with_columns(
arg_max = pl$col("s")$list$arg_max()
)
#> shape: (2, 2)
#> ┌───────────┬─────────┐
#> │ s ┆ arg_max │
#> │ --- ┆ --- │
#> │ list[i32] ┆ u32 │
#> ╞═══════════╪═════════╡
#> │ [1, 2] ┆ 1 │
#> │ [2, 1] ┆ 0 │
#> └───────────┴─────────┘