- API reference
- Index objects
- pandas.Index.argmax
pandas.Index.argmax#
- Index.argmax(axis=None,skipna=True,*args,**kwargs)[source]#
Return int position of the largest value in the Series.
If the maximum 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 when showing the result.
- *args, **kwargs
Additional arguments and keywords for compatibility with NumPy.
- Returns:
- int
Row position of the maximum value.
See also
Series.argmaxReturn position of the maximum value.
Series.argminReturn position of the minimum value.
numpy.ndarray.argmaxEquivalent method for numpy arrays.
Series.idxmaxReturn index label of the maximum values.
Series.idxminReturn index label of the minimum values.
Examples
Consider dataset containing cereal calories
>>>s=pd.Series({'Corn Flakes':100.0,'Almond Delight':110.0,...'Cinnamon Toast Crunch':120.0,'Cocoa Puff':110.0})>>>sCorn Flakes 100.0Almond Delight 110.0Cinnamon Toast Crunch 120.0Cocoa Puff 110.0dtype: float64
>>>s.argmax()2>>>s.argmin()0
The maximum cereal calories is the third element andthe minimum cereal calories is the first element,since series is zero-indexed.
On this page