Reputation: 306
I have a df df = pd.DataFrame({'col1': [1,2,3,4,5,6]})
and I would like to use df.isin()
and find values greater than x. I was trying something like df.isin( < 3 )
. The end output would look like
col1
0 False
1 False
2 True
3 True
4 True
5 True`
What would a solution be?
Upvotes: 0
Views: 1234
Reputation: 308
You can use df.isin(range(3,7))
but using df >= 3
would also produce the same result.
Upvotes: 1
Reputation: 97
If you need your dataframe with filtering on some condition, you can do it like this:
df.loc[df['col1'] < 3]
If you need exactly the output in your question, then it's even more simple:
df['col1'] < 3
Upvotes: 0