title: Add calculated field inside Pandas pivot table
body: <p>I want to add a calculated field to a <code>Pandas</code> pivot table like you would in excel. I plan on adding <code>totals</code> to my <code>pivot table</code> so I would like the calculation to happen inside the <code>pd.pivot_table()</code>. My data looks something like this:</p>
  
  <pre><code>df = {'name' : ['AAA','BBB','CCC','AAA'],
        'product' : ['X','Y','Z','W'],
        'Jan-2016' : [50,55,80,150],
        'Feb - 2016' :[35,55,10,100],
        'Jan-2017' : [25,27,40,20],
        'Feb - 2017' : [55,25,40,65]}
  df = pd.DataFrame(df)
  
  pd.pivot_table(df, values=['Jan-2016','Feb-2016','Jan-2017','Feb-2017','YTD YOY - Jan'],index=['name', 'product'])
  
                Feb-2016  Feb-2017  Jan-2016  Jan-2017
  name product                                        
  AAA  W             100        65       150        20
       X              35        55        50        25
  BBB  Y              55        25        55        27
  CCC  Z              10        40        80        40
  </code></pre>
  
  <p>I would like to add a calculated field to the pivot table so it will look like this:</p>
  
  <pre><code>              Feb-2016  Feb-2017  Jan-2016  Jan-2017  YTD YOY - Jan
  name product                                                       
  AAA  W           100.0     65.00    150.00      20.0      -0.866667
       X            35.0     55.00     50.00      25.0      -0.500000
  BBB  Y            55.0     25.00     55.00      27.0      -0.509091
  CCC  Z            10.0     40.00     80.00      40.0      -0.500000
  </code></pre>
  
  <p>Thanks in advance! </p>