You are viewing documentation about an older version (1.18.0). View latest version

modin.pandas.DataFrame.idxmax¶

DataFrame.idxmax(axis=0, skipna=True, numeric_only=False)[source]¶

Return index of first occurrence of maximum over requested axis.

Parameters:
  • axis ({0 or 1}, default 0) – The axis to use. 0 for row-wise, 1 for column-wise.

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

  • numeric_only (bool, default False:) – Include only float, int or boolean data.

Return type:

Series if DataFrame input, Index if Series input

Examples

>>> df = pd.DataFrame({'consumption': [10.51, 103.11, 55.48],
...                     'co2_emissions': [37.2, 19.66, 1712]},
...                   index=['Pork', 'Wheat Products', 'Beef'])
>>> df
                consumption  co2_emissions
Pork                  10.51          37.20
Wheat Products       103.11          19.66
Beef                  55.48        1712.00
>>> df.idxmax()
consumption      Wheat Products
co2_emissions              Beef
dtype: object
>>> df.idxmax(axis=1)
Pork              co2_emissions
Wheat Products      consumption
Beef              co2_emissions
dtype: object
>>> s = pd.Series(data=[1, None, 4, 3, 4],
...               index=['A', 'B', 'C', 'D', 'E'])
>>> s.idxmax()
'C'
>>> s.idxmax(skipna=False)  
nan
Copy