Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Question on the adfuller bug.

I've tested ADF with stattools, my code is

import statsmodels.tsa.stattools as ts  
from datetime import datetime

import zipline  
from zipline import TradingAlgorithm  
from zipline.api import order_target, record, symbol, history, add_history

data = get_pricing(['AAPL'],start_date='2015-01-13',end_date = '2015-02-13',frequency='daily')  
result = ts.adfuller(data.price.values,1)

However, I've got the following error,

ValueError                                Traceback (most recent call last)  
<ipython-input-45-44774ff05797> in <module>()  
      7  
      8 data = get_pricing(['AAPL'],start_date='2015-01-13',end_date = '2015-02-13',frequency='daily')  
----> 9 result = ts.adfuller(data.price.values,1)

/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/stattools.pyc in adfuller(x, maxlag, regression, autolag, store, regresults)
    209  
    210     xdiff = np.diff(x)  
--> 211     xdall = lagmat(xdiff[:, None], maxlag, trim='both', original='in')  
    212     nobs = xdall.shape[0]  # pylint: disable=E1103  
    213 

/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/tsatools.pyc in lagmat(x, maxlag, trim, original)
    322     if x.ndim == 1:  
    323         x = x[:,None]  
--> 324     nobs, nvar = x.shape  
    325     if original in ['ex','sep']:  
    326         dropidx = nvar

ValueError: too many values to unpack

I couldn't see the problem. I think the parameters of adfullter is ok.

Anyone could help?? Thanks a lot...