I have a numpy array, called a , I want to check whether it contains an item in a range, specified by two values.
import numpy as np
a = np.arange(1
Numpy arrays doesn't work well with pythonic a < x < b. But there's func for this:
np.logical_and(a > mintrshold, a < maxtreshold)
or
np.logical_and(a > mintrshold, a < maxtreshold).any()
in your particular case. Basically, you should combine two element-wise ops. Look for logic funcs for more details