title: Python Time Series Dickey-Fuller ValueError: too many values to unpack (expected 2)
body: <p>I'm attempting to perform a Time Series analysis, and in the process I'm performing the Dickey Fuller Test to check for stationarity of my data frame.</p>
  
  <p>I keep getting the error <code>ValueError: too many values to unpack (expected 2)</code>. I have removed any rows with <code>NaN</code>'s from the dataframe. The only thing I can think of is the <code>dftest[0:4]</code> (in line 4 of the below code), and the <code>dftest[4]</code> (in line 6). I don't know what these values mean, which may be causing the error. I've tried shift tab to get an explanation but nothing is helpful. I've also tried <code>dftest[0:1]</code> which didn't work. FYI my data frame is only 2 columns</p>
  
  <pre><code>from statsmodels.tsa.stattools import adfuller
  def test_stationarity(homepriceTS):
  
      #Determing rolling statistics
      rolmean = pd.rolling_mean(homepriceTS, window=12)
      rolstd = pd.rolling_std(homepriceTS, window=12)
  
      #Plot rolling statistics:
      orig = plt.plot(homepriceTS, color='blue',label='Original')
      mean = plt.plot(rolmean, color='red', label='Rolling Mean')
      std = plt.plot(rolstd, color='black', label = 'Rolling Std')
      plt.legend(loc='best')
      plt.title('Rolling Mean &amp; Standard Deviation')
      plt.show(block=False)
  
      #Perform Dickey-Fuller test:
      print 'Results of Dickey-Fuller Test:'
      dftest = adfuller(homepriceTS, autolag='AIC')
      dfoutput = pd.Series(dftest[0:4], index=['Test Statistic','p-value','#Lags Used','Number of Observations Used'])
      for key,value in dftest[4].items():
          dfoutput['Critical Value (%s)'%key] = value
          dfoutput
  </code></pre>
  
  <p>I have been following along with the pretty good time series step by step here:
  <a href="https://www.analyticsvidhya.com/blog/2016/02/time-series-forecasting-codes-python/" rel="nofollow noreferrer">https://www.analyticsvidhya.com/blog/2016/02/time-series-forecasting-codes-python/</a></p>