title: How to divide two DataFrames by key
body: <p>Here is a pandas problem. Given two dataframes, for example like this:</p>
  
  <pre><code>A = 
  key    val  
  -----------
  spam    10
  eggs    20 
  ham     30
  
  
  B = 
  key    val
  -----------
  eggs    2
  spam    1
  ham     3
  </code></pre>
  
  <p>Note that the rows are permuted.</p>
  
  <p>How can I divide <code>A.val / B.val</code> so the result is:</p>
  
  <pre><code>key    val
  -----------
  spam    10
  eggs    10
  ham     10
  </code></pre>
  
  <p>In words, the values are divided if their keys match. Order of rows does not matter.</p>