I saw good posts that perfectly answer my title question (including this one), but I am in a more specific situation.
Let's say I have the following very simple DataFrame
df.head()
param accuracy
0 None 98
1 4.0 100
2 5.0 95
3 6.0 87
4 7.0 56
5 8.0 45
6 9.0 59
7 None 96
...
I would like to restrict my DataFrame to data where param is either None or 4. I tried the following technique
params = [None, 4]
df = df[df['param'].isin(params)]
which only selects data where param is 4.
This post shows how to filter None values with isnull()
method, but it is not compatible with isin()
... Hence my question.