title: Conditionally select by matching values of a dictionary to columns of a data frame python
body: <p>I have a dictionary as below:</p>
  
  <pre><code>dict = {0: [a,b,d,c],
          3:[w,v,t,e],...}
  </code></pre>
  
  <p>A data frame as below:</p>
  
  <pre><code>col1   col2   col3
  a      d      10
  a      b      5
  a      c      20
  b      a      5
  b      d      3
  b      c      8
  d      a      10
  d      b      3
  d      c      12
  c      a      20
  c      b      8
  c      d      12
  </code></pre>
  
  <p>I want to map each unique combination in the values of dictionary to match col1 and col2, then select col3 and append the key.
  Results should as below:</p>
  
  <pre><code>col1 col2 col3 key
  a    b    5     0
  a    d    10    0
  a    c    20    0
  b    d    3     0
  b    c    8     0
  d    c    12    0
  </code></pre>