I have a table like the following:
+---+----+----+
| id|Sell| Buy|
+---+----+----+
| A|null|null|
| B| Y| Y|
| C|null| Y|
| D| Y|null|
| E|null|null|
+---+----+----+
I can easilty filter single or both columns when value equals "Y". For example, the following filters when both columns are "Y":
df.filter((df["Buy"] == "Y") & (df["Sell"] == "Y"))
However, how can I filter for when a single column or both columns do not equal "Y"?? What is the code for each case? I have tried these codes, and they return no rows:
df.filter((df["Buy"] != "Y") & (df["Sell"] != "Y"))
df.filter(~((df["Buy"] == "Y") | (df["Sell"] == "Y")))
It seems it does not capture null values