title: Calculating Autocorrelation of Pandas DataFrame along each Column
body: <p>I want to calculate the autocorrelation coefficients of lag length one among columns of a Pandas DataFrame. A snippet of my data is:</p>
  
  <pre><code>            RF        PC         C         D        PN        DN         P
  year                                                                      
  1890       NaN       NaN       NaN       NaN       NaN       NaN       NaN
  1891 -0.028470 -0.052632  0.042254  0.081818 -0.045541  0.047619 -0.016974
  1892 -0.249084  0.000000  0.027027  0.067227  0.099404  0.045455  0.122337
  1893  0.653659  0.000000  0.000000  0.039370 -0.135624  0.043478 -0.142062
  </code></pre>
  
  <p>Along <strong>year</strong>, I want to calculate autocorrelations of lag one for each column (<strong>RF</strong>, <strong>PC</strong>, etc...). </p>
  
  <p>To calculate the autocorrelations, I extracted two time series for each column whose start and end data differed by one year and then calculated correlation coefficients with <code>numpy.corrcoef</code>.   </p>
  
  <p>For example, I wrote: </p>
  
  <p><code>numpy.corrcoef(data[['C']][1:-1],data[['C']][2:])</code>   </p>
  
  <p>(the entire DataFrame is called <code>data</code>).<br>
  However, the command unfortunately returned: </p>
  
  <pre><code>array([[ nan,  nan,  nan, ...,  nan,  nan,  nan],
         [ nan,  nan,  nan, ...,  nan,  nan,  nan],
         [ nan,  nan,  nan, ...,  nan,  nan,  nan],
         ..., 
         [ nan,  nan,  nan, ...,  nan,  nan,  nan],
         [ nan,  nan,  nan, ...,  nan,  nan,  nan],
         [ nan,  nan,  nan, ...,  nan,  nan,  nan]])
  </code></pre>
  
  <p>Can somebody kindly advise me on how to calculate autocorrelations? </p>