- API reference
- Series
- pandas.Series.idxmin
pandas.Series.idxmin#
- Series.idxmin(axis=0,skipna=True,*args,**kwargs)[source]#
Return the row label of the minimum value.
If multiple values equal the minimum, the first row label with thatvalue is returned.
- Parameters:
- axis{0 or ‘index’}
Unused. Parameter needed for compatibility with DataFrame.
- skipnabool, default True
Exclude NA/null values. If the entire Series is NA, the resultwill be NA.
- *args, **kwargs
Additional arguments and keywords have no effect but might beaccepted for compatibility with NumPy.
- Returns:
- Index
Label of the minimum value.
- Raises:
- ValueError
If the Series is empty.
See also
numpy.argminReturn indices of the minimum values along the given axis.
DataFrame.idxminReturn index of first occurrence of minimum over requested axis.
Series.idxmaxReturn indexlabel of the first occurrence of maximum of values.
Notes
This method is the Series version of
ndarray.argmin. This methodreturns the label of the minimum, whilendarray.argminreturnsthe position. To get the position, useseries.values.argmin().Examples
>>>s=pd.Series(data=[1,None,4,1],...index=['A','B','C','D'])>>>sA 1.0B NaNC 4.0D 1.0dtype: float64
>>>s.idxmin()'A'
Ifskipna is False and there is an NA value in the data,the function returns
nan.>>>s.idxmin(skipna=False)nan