I have the following series:
0 0.0149
1 0.00088
2 0.00322
3 0.00357
4 0.0101
Of type and shape: dtype: object <class 'pandas.core.series.Series'> (5,)
I am trying to return the index of the minimum element 1, in this case 2
I have tried the following methods idxmin() and argmin() but keep getting
TypeError: reduction operation 'argmin' not allowed for this dtype
CodePudding user response:
Convert values of Series
to numeric before using Series.idxmin
:
out = s.astype(float).idxmin() 1