polars.Series.list.arg_max#

Series.list.arg_max() Series[source]#

Retrieve an index of a maximum value in every sublist.

When multiple values are equal to the maximum, this function may arbitrarily return the index of any of the maximum values. In this case, the returned index is not guaranteed to be the same across multiple runs.

Returns:
Series

Series of data type UInt32 or UInt64 (depending on compilation).

Examples

>>> s = pl.Series("a", [[1, 2], [2, 1]])
>>> s.list.arg_max()
shape: (2,)
Series: 'a' [u32]
[
    1
    0
]