I have a dataframe that I want to filter by value more than 20
ID value
A 10
B 21
C 22
I used df['ID'] > 20 and received result
False
True
True
However, I want it to return B, C, not boolean value
df.loc is your friend:
df.loc[df['value'] > 20, 'ID']
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