title: Calculating year over year growth by group in Pandas
body: <p>I have the following <code>dataframe</code>:</p>
  
  <pre><code>In [1]: df
  Out[1]: 
  
  ID            Month           Transaction_Amount
  
  1             2013/01         10
  1             2013/02         20
  1             2013/03         10
  1             2013/04         20
  1             2013/05         10
  1             2013/06         20
  1             2013/07         10
  1             2013/08         20
  1             2013/09         10
  1             2013/10         20
  1             2013/11         10
  1             2013/12         20
  1             2014/01         15
  1             2014/02         25
  1             2014/03         15
  1             2014/04         25
  ...
  1             2014/11         15
  1             2014/12         25
  ...
  10000000      2014/11         13
  10000000      2014/12         23
  </code></pre>
  
  <p>What I would like to do is calculate the growth over rolling month periods year over year, so for example, I would want to find the value of <code>(2014/01 - 2013/01) / (2014/01)</code> which is <code>(15 - 10) / (15) = 1/3</code> and save this for the first rolling period.  There will be a total of 12 rolling periods for each <code>ID</code>.  I'm thinking that the final output should look like:</p>
  
  <pre><code>In [2]: df_new
  Out[2]: 
  
  ID       rolling_period_1   rolling_period_2  ... rolling_period_12
  
  1        .333333            .25                   .25
  2        x1                 x2                    x12
  3        y1                 y2                    y12
  4        z1                 z2                    z12
  ...
  </code></pre>
  
  <p>I generated a list containing tuples of every year over period <code>[(2013/01, 2014/01), (2013/02, 2014/02) ... (2013/12, 2014/12)]</code> and have been playing around with <code>isin</code> to index a subset of the original <code>df</code>, but I am unsure how to arrive at the <code>df_new</code>.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I have created a new dataframe called <code>temp_df</code> with the following code:</p>
  
  <pre><code>In [4]: temp_df = df[df['month'].isin(('2013/01','2014/01'))]
  
  In [5]: temp_df
  Out[5]:
  
  ID            Month           Transaction_Amount
  
  1             2013/01         10
  1             2014/01         15
  2             2013/01         20
  2             2014/01         30
  3             2013/01         15
  3             2014/01         30
  ...
  </code></pre>
  
  <p>What I would like to produce is a <code>DataFrame</code> that looks like the following:</p>
  
  <pre><code>In [6]: new_df
  Out[6]:
  
  ID            Transaction_Growth
  
  1             .3333   # (15-10)/15
  2             .3333   # (30-20)/30
  3             .50     # (30-15)/30
  ...
  </code></pre>