title: In a pandas dataframe how do i add a field that is a running total with a group by
body: <p>I have the following dataframe:</p>
  
  <pre><code>import pandas
  
  mydata = [{'city': 'London', 'age': 75, 'fdg': 1.78},
            {'city': 'Paris', 'age': 22, 'fdg': 1.56},
            {'city': 'Paris', 'age': 32, 'fdg': 1.56},
            {'city': 'New York', 'age': 37, 'fdg': 1.56},
            {'city': 'London', 'age': 24, 'fdg': 1.56},
            {'city': 'London', 'age': 22, 'fdg': 1.56},
            {'city': 'New York', 'age': 60, 'fdg': 1.56},
            {'city': 'Paris', 'age': 22, 'fdg': 1.56},
  
  
            ]
  df = pandas.DataFrame(mydata)
  
     age      city   fdg
  0   75    London  1.78
  1   22     Paris  1.56
  2   32     Paris  1.56
  3   37  New York  1.56
  4   24    London  1.56
  5   22    London  1.56
  6   60  New York  1.56
  7   22     Paris  1.56
  </code></pre>
  
  <p>I'd like to add a field to the end called age_total which will be a cumulative total of the age field.  The cumulative calculation would work over a group by of city - So row 1 for London would be 75, row 2 for Paris would be 22 and row 3 for Paris would be 54 - (22+32)</p>