title: Pandas add calculated column to groupby result
body: <p>The below  python script computes the following.</p>
  
  <ol>
  <li>A report of the total revenue from each customer</li>
  <li>A report for each customer showing how much of their spending went to each category.</li>
  </ol>
  
  <p>I want to compute the sales tax component for each of the reports.</p>
  
  <p>(All the items have a sales tax of 9.25%.)</p>
  
  <pre><code>import pandas as pd
  from io import StringIO
  
  mystr = """Pedro|groceries|apple|1.42
  Nitin|tobacco|cigarettes|15.00
  Susie|groceries|cereal|5.50
  Susie|groceries|milk|4.75
  Susie|tobacco|cigarettes|15.00
  Susie|fuel|gasoline|44.90
  Pedro|fuel|propane|9.60"""
  
  df = pd.read_csv(StringIO(mystr), header=None, sep='|',
                   names=['Name', 'Category', 'Product', 'Sales'])
  
  # Report 1
  rep1 = df.groupby('Name')['Sales'].sum()
  
  # Name
  # Nitin    15.00
  # Pedro    11.02
  # Susie    70.15
  # Name: Sales, dtype: float64
  
  # Report 2
  rep2 = df.groupby(['Name', 'Category'])['Sales'].sum()
  
  # Name   Category 
  # Nitin  tobacco      15.00
  # Pedro  fuel          9.60
  #        groceries     1.42
  # Susie  fuel         44.90
  #        groceries    10.25
  #        tobacco      15.00
  # Name: Sales, dtype: float64
  </code></pre>