Series.argmax(self, axis=0, skipna=True, *args, **kwargs)
[source]
Return the row label of the maximum value.
Deprecated since version 0.21.0.
The current behaviour of ‘Series.argmax’ is deprecated, use ‘idxmax’ instead. The behavior of ‘argmax’ will be corrected to return the positional maximum in the future. For now, use ‘series.values.argmax’ or ‘np.argmax(np.array(values))’ to get the position of the maximum row.
If multiple values equal the maximum, the first row label with that value is returned.
Parameters: |
|
---|---|
Returns: |
|
Raises: |
|
See also
numpy.argmax
DataFrame.idxmax
Series.idxmin
This method is the Series version of ndarray.argmax
. This method returns the label of the maximum, while ndarray.argmax
returns the position. To get the position, use series.values.argmax()
.
>>> s = pd.Series(data=[1, None, 4, 3, 4], ... index=['A', 'B', 'C', 'D', 'E']) >>> s A 1.0 B NaN C 4.0 D 3.0 E 4.0 dtype: float64
>>> s.idxmax() 'C'
If skipna
is False and there is an NA value in the data, the function returns nan
.
>>> s.idxmax(skipna=False) nan
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.Series.argmax.html