title: How do I efficiently find the row indices of multiple elements in a 2D matrix?
body: <p>say,</p>
  
  <pre><code>C = [ [1,2,3],[1,3,4],[3,5,6]]
  item_list=[1,3,4]
  </code></pre>
  
  <p>I used the following code to accomplish what I wanted :</p>
  
  <pre><code>    rind = [[i for i in range(len(C)) if item in C[i]]
          for item in item_list]
  </code></pre>
  
  <p>I got the rind to be 
  [[0, 1], [0, 1, 2], [1]]</p>
  
  <p>I actually want my o/p to be as a 1d array like [0 1 0 1 2 1]</p>
  
  <p>Could you either suggest a completely alternative approach to obtain row indices or advise me on how  to convert the list of arrays to a 1D array ?</p>
  
  <p>Please note that the actual size of C is 2 M * 4 and item_list is 20000.</p>