multiple conditions in numpy.where
numpy, python
Solution
You want to get a logical/boolean array as your argument for `where`
You can do `x | y` or `np.logical_or(x,y)` , where `x` and `y` are `a < 4` and `a > 12`
Problem
With some numpy array a, what I'd like to do is ``` indices = np.where((a < 4) or (a > 12)) ``` This isn't valid. It just returns "The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()". But this expression isn't ambiguous, and `any` and `all` don't do what I want to do. (`any` and `all` can't take compound expressions either. But `if` can. Confused...)