polars.Series.arg_max#

Series.arg_max() int | None[source]#

Get an index of a maximal value.

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:
int

Examples

>>> s = pl.Series("a", [3, 2, 1])
>>> s.arg_max()
0