xorbits.pandas.Series.idxmax#

Series.idxmax(axis: Axis = 0, skipna: bool = True, *args, **kwargs) Hashable[源代码]#

Return the row label of the maximum value.

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

参数
  • axis ({0 or 'index'}) – Unused. Parameter needed for compatibility with DataFrame.

  • skipna (bool, default True) – Exclude NA/null values. If the entire Series is NA, the result will be NA.

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

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

返回

Label of the maximum value.

返回类型

Index

引发

ValueError – If the Series is empty.

参见

numpy.argmax

Return indices of the maximum values along the given axis.

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.

提示

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

警告

This method has not been implemented yet. Xorbits will try to execute it with pandas.

This docstring was copied from pandas.core.series.Series.