title: Pandas: multiply column value by sum of group
body: <p>I have a dataframe which looks like this:</p>
  <pre><code>   a     b
  0  A  0.15
  1  A  0.25
  2  A  0.10
  3  B  0.20
  4  B  0.10
  5  B  0.25
  6  B  0.60
  7  C  0.50
  8  C  0.70
  </code></pre>
  <p>I want to add a column 'c' which multiplies the value of 'b' by the sum of the group it belongs to in column 'a'. So, first row should be 0.15 * 0.5 (sum of group A) = 0.075. This would be the excel formula for column 'c' =B1*SUMIF($A$1:$A$9,A1,$B$1:$B$9)</p>
  <p>Resulting dataframe should look like this:</p>
  <pre><code>    a   b       c
  0   A   0.15    0.075
  1   A   0.25    0.125
  2   A   0.10    0.05
  3   B   0.20    0.23
  4   B   0.10    0.115
  5   B   0.25    0.2875
  6   B   0.60    0.69
  7   C   0.50    0.6
  8   C   0.70    0.84
  </code></pre>