For the following data frame I want to filter data based on count value. I want to keep count 10, 5, and 2:
index count
1 10
2 5
3 2
4 1
5 6
6 7
7 "tab"
I know that I can write the code as
df[(df.count==10) | (df.count==5) | (df.count==2) | (df.count=="tab")]
Is there any simpler way to do it? I have more than 20 values. I tried the following, but it did not work:
df[(df.count==[10, 5, 2, "tab"])
Thank you.