title: Copy groupby().agg to each row
body: <p>I am looking for a way to copy the result of an aggregate call to each row in a dataframe.</p>
  
  <p>I am currently doing it like this:</p>
  
  <pre><code>tmp = df.groupby('somekey').col_to_sum.sum().reset_index()
  df = df.merge(tmp, how='left', on='somekey')
  </code></pre>
  
  <p>This gives me the result I want:
  <code>tmp</code> is a series of the sum for each value of <code>somekey</code> and the merge then "copies it" to each row in the original <code>df</code> (so each row contains the sum value).</p>
  
  <p>Is there a shorter way to achieve the same result?</p>