title: How to use groupby in Pandas to compute columns
body: <p>I have a table based on data that is not aggregated. I want to use GroupBy to "slice" my data and compute averages for each scenario.</p>
  
  <p>For example, let's look at some heroes in dota since it's a fun game:</p>
  
  <pre><code>Bracket MatchID Duration    Hero    Radiant Win Kills   Deaths  Assists GPM XPM CS  Denies  Level   HeroDMG
  0   n   32966652    1523    Pugna   True    True    1   1   3   292 265 28  5   11  3056
  1   n   32966652    1523    Lich    True    True    3   0   8   288 297 36  3   11  5115
  2   n   32966652    1523    Lina    True    True    8   2   1   378 366 63  1   13  9537
  3   n   32966652    1523    Kunkka  True    True    5   0   4   415 351 73  0   12  6239
  4   n   32966652    1523    Bounty Hunter   True    True    1   0   2   465 362 131 4   13  1400
  </code></pre>
  
  <p>I would like to see what's the average GPM for each hero when they win or lose, and I would also like to see how it varies across brackets ("n", "h" or "v" that mean "Normal", "High Skill" or "Very high skill").</p>
  
  <p>I would therefore run:</p>
  
  <pre><code>gpm = data.groupby(["Hero", "Bracket", "Win"]).mean()
  </code></pre>
  
  <p>And get something like this:</p>
  
  <pre><code>                        MatchID          Duration   Radiant      Kills      Deaths      Assists       GPM          XPM             CS      Denies   Level       HeroDMG
  Hero    Bracket Win                                             
  Alchemist   h   False   30983107.993671 2302.712025 0.462025    2.639241    8.139241    8.379747    285.753165  365.015823  113.784810  4.310127    15.674051   6132.193038
                  True    30998808.981395 2499.879070 0.544186    5.265116    5.325581    15.195349   445.200000  521.162791  157.493023  4.855814    19.683721   9514.841860
              n   False   30438522.501672 2536.304348 0.494983    2.705686    8.103679    9.250836    254.806020  339.187291  98.311037   3.170569    15.829431   6201.595318
                  True    30305649.194805 2683.688312 0.476190    5.320346    5.502165    15.705628   391.030303  484.995671  133.926407  3.506494    19.705628   9246.168831
              v   False   28020985.500000 2142.162879 0.518939    2.670455    7.560606    7.613636    302.996212  372.867424  119.337121  5.696970    15.284091   6232.712121
                  True    28259817.386503 2415.957055 0.595092    5.171779    5.233129    15.018405   486.736196  546.564417  174.932515  7.245399    19.877301   10143.98773
  </code></pre>
  
  <p>Now, I would like to define Alchemist based on all of these numbers, let's call them "Hero-related features". My objective is to have each hero be a data point in this space of features, thus I would like to have something like this:</p>
  
  <pre><code>Hero        Kills_High_Win   Kills_High_Loss  Kills_Normal_Win   Kills_Normal_Loss
  Alchemist  5.265116           2.639241         5.320346          2.705686
  </code></pre>
  
  <p>And so on for all the features in the table. I would also like to generate the name of the columns automatically based on these scenarios - the name can be anything as long as is connected to the actual combination (like "Bracket" == "n" and "Win" == "True").</p>