pandas.Series.idxmin¶
Return the row label of the minimum value.
If multiple values equal the minimum, the first row label with that value is returned.
- param skipna
- bool, default True
Exclude NA/null values. If the entire Series is NA, the result will be NA.
- param axis
- int, default 0
For compatibility with DataFrame.idxmin. Redundant for application on Series. *args, **kwargs Additional keywords have no effect but might be accepted for compatibility with NumPy.
- return
Index Label of the minimum value.
- raises
- ValueError
If the Series is empty.
Limitations¶
Parameter axis
is supported only with default value None
.
Parameter skipna
cannot be False
with data of string type.
Examples¶
import numpy as np
import pandas as pd
from numba import njit
@njit
def series_idxmin():
s = pd.Series([4, np.nan, 2, 1], index=['A', 'B', 'C', 'D'])
return s.idxmin() # Expect index of minimum value D
print(series_idxmin())
$ python ./series/series_idxmin.py
D
See also
- Series.idxmax
Return index label of the first occurrence of maximum of values.
- numpy.absolute
Return indices of the minimum values along the given axis.
- DataFrame.idxmin
Return index of first occurrence of minimum over requested axis.