'Please guys what might the cause of this error am recieving

TypeError: Cannot perform 'ror_' with a dtyped [bool] array and scalar of type [NoneType]

###I receive this error whenever i run this code.

print(df < (Q1 - 1.5 * IQR)) |(df > (Q3 + 1.5 * IQR))

Please what am I not doing right?



Solution 1:[1]

I think you have a problem with your parenthesis but Did you try to use or instead of |

btw: you can debug your code by printing each statement alone and see whats not right, something like this:

n1 = Q1 - 1.5 * IQR
print(df < n1)
n2 = Q3 + 1.5 * IQR
print(df > n2)

print(df < n1 or df > n2)

Solution 2:[2]

| is no legal boolean operator in python. You should use the keyword „or“ instead.

////////////////

print(df < (Q1 - 1.5 * IQR) or df > (Q3 + 1.5 * IQR))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ali Rn
Solution 2 ouflak