pandas 1.4.2

NotesParametersRaisesReturnsBackRef
idxmax(self, axis=0, skipna=True, *args, **kwargs)

If multiple values equal the maximum, the first row label with that value is returned.

Notes

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() .

Parameters

axis : int, default 0

For compatibility with DataFrame.idxmax. Redundant for application on Series.

skipna : bool, default True

Exclude NA/null values. If the entire Series is NA, the result will be NA.

*args, **kwargs :

Additional arguments and keywords have no effect but might be accepted for compatibility with NumPy.

Raises

ValueError

If the Series is empty.

Returns

Index

Label of the maximum value.

Return the row label of the maximum value.

See Also

DataFrame.idxmax

Return index of first occurrence of maximum over requested axis.

Series.idxmin

Return index label of the first occurrence of minimum of values.

numpy.argmax

Return indices of the maximum values along the given axis.

Examples

This example is valid syntax, but we were not able to check execution
>>> 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
This example is valid syntax, but we were not able to check execution
>>> s.idxmax()
'C'

If :None:None:`skipna` is False and there is an NA value in the data, the function returns nan .

This example is valid syntax, but we were not able to check execution
>>> s.idxmax(skipna=False)
nan
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

pandas.core.series.Series.idxmin pandas.core.frame.DataFrame.idxmax pandas.core.base.IndexOpsMixin.argmin pandas.core.generic.NDFrame._add_numeric_operations.<locals>.prod pandas.core.generic.NDFrame._add_numeric_operations.<locals>.sum pandas.core.base.IndexOpsMixin.argmax pandas.core.generic.NDFrame._add_numeric_operations.<locals>.min pandas.core.indexes.base.Index.argmax pandas.core.groupby.generic.DataFrameGroupBy.idxmax pandas.core.generic.NDFrame._add_numeric_operations.<locals>.max pandas.core.indexes.base.Index.argmin

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/series.py#2339
type: <class 'function'>
Commit: