title: Finding indices of values in 2D numpy array
body: <p>I'm trying to get the index values out of a numpy array, I've tried using intersects instead to no avail. I'm simply trying to find like values in 2 arrays. One is 2D and I'm selecting a column, and the other is 1D, just a list of values to search for, so effectively just 2 1D arrays.</p>
  
  <p>We'll call this array a:</p>
  
  <pre><code> array([[    1, 97553,     1],
         [    1, 97587,     1],
         [    1, 97612,     1],
         [    1, 97697,     1],
         [    1, 97826,     3],
         [    1, 97832,     1],
         [    1, 97839,     1],
         [    1, 97887,     1],
         [    1, 97944,     1],
         [    1, 97955,     2]])
  </code></pre>
  
  <p>And we're searching say, <code>values = numpy.array([97612, 97633, 97697, 97999, 97943, 97944])</code></p>
  
  <p>So I try:</p>
  
  <pre><code>numpy.where(a[:, 1] == values)
  </code></pre>
  
  <p>And I'd expect a bunch of indices of the values, but instead I get back an array that's empty, it spits out <code>[(array([], dtype=int64),)]</code>.</p>
  
  <p>If I try this though:</p>
  
  <pre><code>numpy.where(a[:, 1] == 97697)
  </code></pre>
  
  <p>It gives me back <code>(array([2]),)</code>, which is what I would expect.</p>
  
  <p>What weirdness of arrays am I missing here? Or is there maybe even an easier way to do this? Finding array indices and matching arrays seems to not work as I expect at all. When I want to find the unions or intersects of arrays, by indice or unique value it just doesn't seem to function. Any help would be super. Thanks.</p>
  
  <p><strong>Edit:</strong>
  As per Warrens request:</p>
  
  <pre><code>import numpy
  
  a = numpy.array([[    1, 97553,     1],
         [    1, 97587,     1],
         [    1, 97612,     1],
         [    1, 97697,     1],
         [    1, 97826,     3],
         [    1, 97832,     1],
         [    1, 97839,     1],
         [    1, 97887,     1],
         [    1, 97944,     1],
         [    1, 97955,     2]])
  
  values = numpy.array([97612, 97633, 97697, 97999, 97943, 97944])
  </code></pre>
  
  <p>I've found that <code>numpy.in1d</code> will give me a correct truth table of booleans for the operation, with a 1d array of the same length that should map to the original data. My only issue here is now how to act with that, for instance deleting or modifying the original array at those indices. I could do it laboriously with a loop, but as far as I know there are better ways in numpy. Truth tables as masks are supposed to be quite powerful with numpy from what I have been able to find.</p>