I have a numpy 1-D array containing boolean values of True or False. I want to check whether all of them are False such that a single True/False is returned whether all elements in the numpy array are False or True
x = np.array([False, False, False]) # this should return True, since all values are False
y = np.array([True, True, True]) # this should return False, since all values are True
z = np.array([True, False, True]) # this should return False, since not all values are False
I looked into np.all(), but that does not see to solve my problem.
Thanks!
Compare each item with False and then reduce using np.all
np.all(x == False)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With