title: What's the difference between pandas ACF and statsmodel ACF?
body: <p>I'm calculating the Autocorrelation Function for a stock's returns. To do so I tested two functions, the <code>autocorr</code> function built into Pandas, and the <code>acf</code> function supplied by <code>statsmodels.tsa</code>. This is done in the following MWE:</p>
  
  <pre><code>import pandas as pd
  from pandas_datareader import data
  import matplotlib.pyplot as plt
  import datetime
  from dateutil.relativedelta import relativedelta
  from statsmodels.tsa.stattools import acf, pacf
  
  ticker = 'AAPL'
  time_ago = datetime.datetime.today().date() - relativedelta(months = 6)
  
  ticker_data = data.get_data_yahoo(ticker, time_ago)['Adj Close'].pct_change().dropna()
  ticker_data_len = len(ticker_data)
  
  ticker_data_acf_1 =  acf(ticker_data)[1:32]
  ticker_data_acf_2 = [ticker_data.autocorr(i) for i in range(1,32)]
  
  test_df = pd.DataFrame([ticker_data_acf_1, ticker_data_acf_2]).T
  test_df.columns = ['Pandas Autocorr', 'Statsmodels Autocorr']
  test_df.index += 1
  test_df.plot(kind='bar')
  </code></pre>
  
  <p>What I noticed was the values they predicted weren't identical:</p>
  
  <p><a href="https://i.stack.imgur.com/TPuER.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TPuER.png" alt="enter image description here"></a></p>
  
  <p>What accounts for this difference, and which values should be used?</p>