title: Pandas sum two dataframes based on the value of column
body: <p>I have two <em>dataframes</em> that I want to sum along the <code>y</code> axis, conditionally.</p>
  
  <p>For example:</p>
  
  <blockquote>
    <p>df_1</p>
  </blockquote>
  
  <pre>
  a    b    value
  1    1    1011
  1    2    1012
  2    1    1021
  2    2    1022
  </pre>
  
  <blockquote>
    <p>df_2</p>
  </blockquote>
  
  <pre>
  a    b    value
  9    9    99
  1    2    12
  2    1    21
  </pre>
  
  <p>I want to make <code>df_1['value'] -= df_2['value'] if df_1[a] == df_2[a] &amp; df_1[b] == df_2[b]</code>, so the output would be:</p>
  
  <blockquote>
    <p>OUTPUT</p>
  </blockquote>
  
  <pre>
  a    b    value
  1    1    1011
  1    2    1000
  2    1    1000
  2    2    1022
  </pre>
  
  <p>Is there a way to achieve that instead of iterating the whole <em>dataframe</em>? (It's pretty big)</p>