most probably I'm missing something on the any()
function, it says:
Returns True if any of the elements of a evaluate to True.
So in my case below, I would expect true
as an output, as one element count[0]
is larger than 2. However, the output is FALSE
.
What stupid mistake am I doing?!
minimal example:
count = np.zeros(10)
count[0] += 4
count[5] += 1
print(np.any(count,axis=0) > 2)
# parentheses:
np.any(count,axis=0)
#output: True
np.any(count, axis=0)>2
# is a boolean expression. It evaluates to False, because True is not larger than 2.
# So:
np.any(count>2, axis=0)
# should do what you want