title: How can I find matching elements and indices from two arrays?
body: <p>For example,</p>
  <pre><code>a = [1, 1, 2, 4, 4, 4, 5, 6, 7, 100]
  b = [1, 2, 2, 2, 2, 4, 5, 7, 8, 100]
  </code></pre>
  <p>I can find the matching elements using:</p>
  <pre><code>np.intersect1d(a,b)
  </code></pre>
  <p>Output:</p>
  <pre><code>array([  1,   2,   4,   5,   7, 100])
  </code></pre>
  <p>Then, how can I get the indices of matched elements in arrays <code>a</code> and <code>b</code>, respectively ?</p>
  <p>There is a function in IDL as <code>&quot;match&quot;</code> - <a href="https://www.l3harrisgeospatial.com/docs/match.html" rel="nofollow noreferrer">https://www.l3harrisgeospatial.com/docs/match.html</a></p>
  <p>Is there a similar function in Python?</p>