I have a pandas dataframe of multiple minimum values but the min functions picks only one on the column.
ABCD 0.000000
JKLM 0.016535
CAN1 0.381729
MET2 0.275013
INDI 0.149280
MAN3 0.000000
temp2.ix[temp2.idxmin()]
only picks one value that is ABCD with 0.0
I would like to fetch both ABCD and MAN3 as minimum ??
You could use following:
df[df == df.min()].dropna()
In [49]: df[df == df.min()].dropna()
Out[49]:
1
0
ABCD 0
MAN3 0
Next solution is:
df.where(df == df.min()).dropna()
And df.idxmin()
return only one value, because:
This method is the DataFrame version of ndarray.argmin.
And ndarray.argmin
explain this situation in doc:
In case of multiple occurrences of the minimum values, the indices corresponding to the first occurrence are returned.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With