Issue
I have this dataframe:
id check_id
1 10
1 100
2 10
3 34
4 12
1 101
and a list:
list=[10,101]
I am trying to filter this df like this:
df[(df['id']==1) and (df['check_id'].isin(list))]
To get this output:
id check_id
1 10
1 101
but I get this error msg:
The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
I've been trying to solve it but no sucess so far.
How can I fix it?
Solution
If you had searched instead of asking the question, you would have easily got the answer
df[(df['id']==1) & (df['check_id'].isin(list))]
Answered By - Panda Kim
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.