title: Calculating current, min, max, mean monthly growth from pandas dataframe
body: <p>I have a dataset similar to the one below: </p>
  
  <pre><code>product_ID month amount_sold
  1          1     23          
  1          2     34          
  1          3     85          
  2          1     47          
  2          2     28          
  2          3     9           
  3          1     73          
  3          2     84          
  3          3     12          
  </code></pre>
  
  <p>I want the output to be like this:</p>
  
  <p>For example, for <strong>product 1</strong>: </p>
  
  <p>-<code>avg_monthly_growth</code> is calculated by ((85-34)/34*100 + (34-23)/23*100)/2 = 98.91%</p>
  
  <p>-<code>lowest_monthly_growth</code> is (34-23)/23*100) = 47.83%</p>
  
  <p>-<code>highest_monthly_growth</code> is (85-34)/34*100) = 150%</p>
  
  <p>-<code>current_monthly_growth</code> is the growth between the lastest two months (in this case, it's the growth from month 2 to month 3, as the <code>month</code> ranges from 1-3 for each product)</p>
  
  <pre><code>product_ID avg_monthly_growth lowest_monthly_growth highest_monthly_growth current_monthly_growth
  1          98.91%             47.83%                150%                   150%
  2          ...                ...                   ...                    ...
  3          ...                ...                   ...                    ...
  </code></pre>
  
  <p>I've tried <code>df.loc[df.groupby('product_ID')['amount_sold'].idxmax(), :].reset_index()</code> which gets me the max (and similarly the min), but I'm not too sure how to get the percentage growths. </p>