title: Returns of multiple stocks using pandas at once
body: <p>I have close prices of multiple stocks over multiple days in a dataframe like this.</p>
  
  <pre><code>In [67]: df
  Out[67]:
            Date Symbol   Close
  0   12/30/2016   AMZN  749.87
  1   12/29/2016   AMZN  765.15
  2   12/28/2016   AMZN  772.13
  3   12/27/2016   AMZN  771.40
  4   12/30/2016  GOOGL  792.45
  5   12/29/2016  GOOGL  802.88
  6   12/28/2016  GOOGL  804.57
  7   12/27/2016  GOOGL  805.80
  8   12/30/2016   NFLX  123.80
  9   12/29/2016   NFLX  125.33
  10  12/28/2016   NFLX  125.89
  11  12/27/2016   NFLX  128.35
  </code></pre>
  
  <p>I would like to compute daily returns of these stocks using pandas. The output should looks like this:</p>
  
  <pre><code>         Date Symbol     Return
  0   12/27/2016   AMZN       NaN
  1   12/28/2016   AMZN  0.000946
  2   12/29/2016   AMZN -0.009040
  3   12/30/2016   AMZN -0.019970
  4   12/27/2016  GOOGL       NaN
  5   12/28/2016  GOOGL -0.001526
  6   12/29/2016  GOOGL -0.002101
  7   12/30/2016  GOOGL -0.012991
  8   12/27/2016   NFLX       NaN
  9   12/28/2016   NFLX -0.019166
  10  12/29/2016   NFLX -0.004448
  11  12/30/2016   NFLX -0.012208
  </code></pre>
  
  <p>I got the above output using following code but I feel this can be simplified further.</p>
  
  <pre><code>In [70]: rtn = df.pivot("Date", "Symbol", "Close").pct_change().reset_index()
  In [73]: pd.melt(rtn, id_vars='Date', value_vars=list(rtn.columns[1:]),var_name='Symbol',value_name='Return')
  </code></pre>