title: reduce a panda dataframe by groups
body: <p>I've been searching extensively but can't get my head around this issue:</p>
  
  <p>I have a dataframe in pandas that looks like this:</p>
  
  <pre><code>date    ticker Name NoShares SharePrice Volume Relation
  2/1/10  aaa    zzz  1        1          1      d 
  2/1/10  aaa    yyy  1        2          5      o
  2/1/10  aaa    zzz  2        5          2      d  
  2/5/10  bbb    xxx  5        5          1      do
  2/5/10  ccc    www  5        5          1      d
  2/5/10  ccc    www  5        5          1      d
  2/5/10  ddd    vvv  5        5          1      o
  2/6/10  aaa    zzz  1        1          3      d
  </code></pre>
  
  <p>Requirements</p>
  
  <ol>
  <li>I want to group by date and Name and:</li>
  <li>have the number of shares summed up</li>
  <li>have a weighted mean column for the share price (the weights are the NoShares)</li>
  <li>average the volume and have it as a column</li>
  <li>Leave relation as it is</li>
  </ol>
  
  <p>so my output would look like this:</p>
  
  <pre><code>date    ticker Name NoShares SharePrice Volume Relation
  2/1/10  aaa    zzz  3        3.6        1      d 
  2/1/10  aaa    yyy  1        2          5      o
  2/5/10  bbb    xxx  5        5          1      do
  2/5/10  ccc    www  10       5          1      d
  2/5/10  ddd    vvv  5        5          1      o
  2/6/10  aaa    zzz  1        1          3      d
  </code></pre>
  
  <p>I tried the documentation and other answers on stack overflow but don't seem to be able to get it right. Appreciate the help. Cheers.</p>