title: Using a pandas dataframe as a lookup table
body: <p>Given a single row from dataframe <code>X</code>, what is the most efficient way to retrieve all rows from dataframe <code>Y</code> that completely match the query row?</p>
  
  <p>Example: querying row <code>[0,1,0,1]</code> from </p>
  
  <pre><code>[
   [0,1,0,1, 1.0],
   [0,1,0,1, 2.0],
   [0,1,0,0, 3.0],
   [1,1,0,0, 0.5],
  ]
  </code></pre>
  
  <p>should return</p>
  
  <pre><code>[
   [0,1,0,1, 1.0],
   [0,1,0,1, 2.0],
  ]
  </code></pre>
  
  <p><code>X</code> and <code>Y</code> are assumed to have the same schema, except that <code>Y</code> has an additional target value column. There may be one, zero, or many matches. The solution should be efficient even with thousands of columns.</p>