title: Find indices of numpy array based on values in another numpy array
body: <p>I want to find the indices in a larger array if they match the values of a different, smaller array. Something like <code>new_array</code> below:</p>
  
  <pre><code>import numpy as np
  summed_rows = np.random.randint(low=1, high=14, size=9999)
  common_sums = np.array([7,10,13])
  new_array = np.where(summed_rows == common_sums)
  </code></pre>
  
  <p>However, this returns: </p>
  
  <pre><code>__main__:1: DeprecationWarning: elementwise comparison failed; this will raise an error in the future. 
  &gt;&gt;&gt;new_array 
  (array([], dtype=int64),)
  </code></pre>
  
  <p>The closest I've gotten is:</p>
  
  <pre><code>new_array = [np.array(np.where(summed_rows==important_sum)) for important_sum in common_sums[0]]
  </code></pre>
  
  <p>This gives me a list with three numpy arrays (one for each 'important sum'), but each is a different length which produces further downstream problems with concatenation and vstacking. To be clear, I do <em>not</em> want to use the line above. I want to use numpy to index into <code>summed_rows</code>. I've looked at various answers using <code>numpy.where</code>, <code>numpy.argwhere</code>, and <code>numpy.intersect1d</code>, but am having trouble putting the ideas together. I figured I'm missing something simple and it would be faster to ask.</p>
  
  <p>Thanks in advance for your recommendations!</p>