polars.Expr.arr.arg_max#

Expr.arr.arg_max() Expr[source]#

Retrieve the index of the maximum value in every sublist.

Returns:
Series of dtype UInt32/UInt64 (depending on compilation)

Examples

>>> df = pl.DataFrame(
...     {
...         "a": [[1, 2], [2, 1]],
...     }
... )
>>> df.select(pl.col("a").arr.arg_max())
shape: (2, 1)
┌─────┐
│ a   │
│ --- │
│ u32 │
╞═════╡
│ 1   │
│ 0   │
└─────┘