title: indexing numpy array with logical operator
body: <p>I have a 2d numpy array, for instance as:</p>
  
  <pre><code>import numpy as np
  a1 = np.zeros( (500,2) )
  
  a1[:,0]=np.arange(0,500)
  a1[:,1]=np.arange(0.5,1000,2)
  # could be also read from txt
  </code></pre>
  
  <p>then I want to select the indexes corresponding to a slice that matches a criteria such as all the value a1[:,1] included in the range (l1,l2): </p>
  
  <pre><code>l1=20.0; l2=900.0; #as example
  </code></pre>
  
  <p>I'd like to do in a condensed expression. However, neither:</p>
  
  <pre><code>np.where(a1[:,1]&gt;l1 and a1[:,1]&lt;l2)
  </code></pre>
  
  <p>(it gives ValueError and it suggests to use np.all, which it is not clear to me in such a case); neither:</p>
  
  <pre><code>np.intersect1d(np.where(a1[:,1]&gt;l1),np.where(a1[:,1]&lt;l2))
  </code></pre>
  
  <p>is working (it gives unhashable type: 'numpy.ndarray')</p>
  
  <p>My idea is then to use these indexes to map another array of size (500,n).</p>
  
  <p>Is there any reasonable way to select indexes in such way? Or: is it necessary to use some mask in such case?</p>