pandas.Series.argmin#

Series.argmin(axis=None, skipna=True, *args, **kwargs)[source]#

Return int position of the smallest value in the Series.

If the minimum is achieved in multiple locations, the first row position is returned.

Parameters:
axis{None}

Unused. Parameter needed for compatibility with DataFrame.

skipnabool, default True

Exclude NA/null values. If the entire Series is NA, or if skipna=False and there is an NA value, this method will raise a ValueError.

*args, **kwargs

Additional arguments and keywords for compatibility with NumPy.

Returns:
int

Row position of the minimum value.

See also

Series.argmin

Return position of the minimum value.

Series.argmax

Return position of the maximum value.

numpy.ndarray.argmin

Equivalent method for numpy arrays.

Series.idxmax

Return index label of the maximum values.

Series.idxmin

Return index label of the minimum values.

Examples

Consider dataset containing cereal calories

>>> s = pd.Series(
...     [100.0, 110.0, 120.0, 110.0],
...     index=[
...         "Corn Flakes",
...         "Almond Delight",
...         "Cinnamon Toast Crunch",
...         "Cocoa Puff",
...     ],
... )
>>> s
Corn Flakes              100.0
Almond Delight           110.0
Cinnamon Toast Crunch    120.0
Cocoa Puff               110.0
dtype: float64
>>> s.argmax()
2
>>> s.argmin()
0

The maximum cereal calories is the third element and the minimum cereal calories is the first element, since series is zero-indexed.