Element-wise logical OR in Pandas

674    Asked by ChristianParsons in QA Testing , Asked on Jun 7, 2021

 I would like the element-wise logical OR operator. I know "or" itself is not what I am looking for.

I am aware that AND corresponds to & and NOT, ~. But what about OR?

You can use this ‘ | ’ operator for pandas or:

 df[(df < 12 xss=removed>

This will check element-wise if value is less than 12 or equal to 15.

You can also use this np.logical_or function.


For multiple conditions use the logical_or.reduce:


Your Answer