Search code examples
pythonpandasseriesdrop

Drop the smallest value from pandas Series


I have a pandas.Series:

Name: vector, dtype: float64
1     74.67
2     87.78
3     97.00

I want to drop the smallest value from Series. I managed to do:

vector = vector[vector != vector.min()]

But what if my Series has got somewhat identical the smallest values like this:

Name: vector, dtype: float64
1     74.67
2     87.78
3     74.67

I would like to drop only one values and leave another one and get Series:

Name: vector, dtype: float64
2     87.78
3     74.67

How can I implement that?


Solution

  • You can use idxmin() to get index of the first smallest value and drop:

    s.drop(s.idxmin())