Examples

In [1]:
import numpy as np
import pandas as pd
In [2]:
s = pd.Series(data=[2, None, 5, 4, 5],
              index=['P', 'Q', 'R', 'S', 'T'])
s
Out[2]:
P    2.0
Q    NaN
R    5.0
S    4.0
T    5.0
dtype: float64

In [3]:
s.idxmax()
Out[3]:
'R'

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

In [4]:
s.idxmax(skipna=False)
Out[4]:
nan