from statsmodels.tsa.stattools import adfuller def DF_Test(ts): stationary = adfuller(ts) ## print the results print('D-F statistic = ' + str(stationary[0])) print('p-value = ' + str(stationary[1])) print('number of lags used = ' + str(stationary[2])) print('Critical value at 5% confidence = ' + str(stationary[4]['5%'])) print('Critical value at 10% confidence = ' + str(stationary[4]['10%'])) DF_Test(decomp.resid[6:-6])