title: Python merge two arrays on specific columns
body: <p>I have two sets/arrays/lists of the form</p>
  
  <pre><code>a = [(12, 14, 0.3, 0.6, 0.8), (16, 18, 0.4, 0.5, 0.3), (19, 22, 0.4, 0.5, 0.3)]
  b = [(12, 14, 44, 12), (5, 4, 66, 12), (19, 22, 96, 45)]
  </code></pre>
  
  <p>And I would like to find <strong>c</strong> which is a list of items from <strong>b</strong> found in <strong>a</strong> such that only the first two elements in the tuple need to match (ex 12 14). So in this case the answer <strong>c</strong> would be</p>
  
  <pre><code>c = [(12, 14, 44, 12), (19, 22, 96, 45)]
  </code></pre>
  
  <p>I used nested loops however it is way too slow. Thanks</p>