0

So I have a dataframe table call latest_key_status, it have two boolean column 'a' and 'b' When I want to filter it by 'a', like this:

latest_key_status.filter(latest_key_status['a'] == False)

It works

However, when I want to do this

latest_key_status.filter((latest_key_status['a'] == False) | (latest_key_status['b'] == False))

It failed

Could anyone tell me how can I do this? Thanks

  • Possible duplicate of https://stackoverflow.com/questions/49301373/pyspark-filter-dataframe-based-on-multiple-conditions – Muhammad Hamza Mar 26 '20 at 07:06
  • by [De Morgan's law](https://en.wikipedia.org/wiki/De_Morgan%27s_laws) you should be able to do `latest_key_status.filter(~(latest_key_status['a']&latest_key_status['b']))` – pault Mar 26 '20 at 13:05

0 Answers0