title: How to calculate percent change compared to the beginning value using pandas?
body: <p>I have a <code>DataFrame</code> and need to calculate percent change compared to the beginning of the year by companies. Is there any way to use <code>pct_change()</code> or other method to perform this task? Thanks!</p>
  
  <p><code>df</code> looks like </p>
  
  <pre><code>security    date        price
  IBM         1/1/2016    100
  IBM         1/2/2016    102
  IBM         1/3/2016    108
  AAPL        1/1/2016    1000
  AAPL        1/2/2016    980
  AAPL        1/3/2016    1050
  AAPL        1/4/2016    1070
  </code></pre>
  
  <p>results I want </p>
  
  <pre><code>security    date        price   change
  IBM         1/1/2016    100     NA
  IBM         1/2/2016    102     2%
  IBM         1/3/2016    108     8%
  AAPL        1/1/2016    1000    NA
  AAPL        1/2/2016    980     -2%
  AAPL        1/3/2016    1050    5%
  AAPL        1/4/2016    1070    7%
  </code></pre>