title: merge 2 dataframes in Pandas: join on some columns, sum up others
body: <p>I want to merge two dataframes on specific columns (key1, key2) and sum up the values for another column (value).</p>
  
  <pre><code>&gt;&gt;&gt; df1 = pd.DataFrame({'key1': range(4), 'key2': range(4), 'value': range(4)})
     key1  key2  value
  0     0     0      0
  1     1     1      1
  2     2     2      2
  3     3     3      3
  
  &gt;&gt;&gt; df2 = pd.DataFrame({'key1': range(2, 6), 'key2': range(2, 6), 'noise': range(2, 6), 'value': range(10, 14)})
     key1  key2  noise  value
  0     2     2      2     10
  1     3     3      3     11
  2     4     4      4     12
  3     5     5      5     13
  </code></pre>
  
  <p>I want this result:</p>
  
  <pre><code>   key1  key2  value
  0     0     0      0
  1     1     1      1
  2     2     2     12
  3     3     3     14
  4     4     4     12
  5     5     5     13
  </code></pre>
  
  <p>In SQL terms, I want:</p>
  
  <pre><code>SELECT df1.key1, df1.key2, df1.value + df2.value AS value
  FROM df1 OUTER JOIN df2 ON key1, key2
  </code></pre>
  
  <p>I tried two approaches:</p>
  
  <p>approach 1</p>
  
  <pre><code>concatenated = pd.concat([df1, df2])
  grouped = concatenated.groupby(['key1', 'key2'], as_index=False)
  summed = grouped.agg(np.sum)
  result = summed[['key1', 'key2', 'value']]
  </code></pre>
  
  <p>approach 2</p>
  
  <pre><code>joined = pd.merge(df1, df2, how='outer', on=['key1', 'key2'], suffixes=['_1', '_2'])
  joined = joined.fillna(0.0)
  joined['value'] = joined['value_1'] + joined['value_2']
  result = joined[['key1', 'key2', 'value']]
  </code></pre>
  
  <p>Both approaches give the result I want, but I wonder if there is a simpler way.</p>