Use a.any() or a.all()

If you take a look at the result of valeur <= 0.6, you can see what’s causing this ambiguity:

>>> valeur <= 0.6
array([ True, False, False, False], dtype=bool)

So the result is another array that has in this case 4 boolean values. Now what should the result be? Should the condition be true when one value is true? Should the condition be true only when all values are true?

That’s exactly what numpy.any and numpy.all do. The former requires at least one true value, the latter requires that all values are true:

>>> np.any(valeur <= 0.6)
True
>>> np.all(valeur <= 0.6)
False

There is one more way you can get this

import numpy as np

a = np.array([1,2,3,4])
b = np.array([5,6,7,8])
c = np.array([1,2,3,4])

print((a == b ).all())  #False
print((a == c ).all())   # True
print((a == b ).any())   #False
print((a == c ).any())   #True
print((a > 3 ).all())    #False