Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dickey-Fuller test in Python

Tags:

python

I was trying to figure out exactly what the following expression means:

Perform Dickey-Fuller test:

print 'Results of Dickey-Fuller Test:'
dftest = adfuller(timeseries, 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
print dfoutput

More specifically what does this [0:4] represent?

like image 612
edost4 Avatar asked Aug 11 '26 02:08

edost4


1 Answers

im not sure exactly what kind of variable dftest is but ill go through each variable so you might get a better understanding of [0:4]

Suppose you had an array like array = [1,2,3,4,5] and you did print(array[0:2]) this will print [1,2]

On the other hand you could have a string which could be word = "awesomeness" and when you print print(word[2:6]) you will get esom hope this helped!:)

like image 189
Kevin Kelbie Avatar answered Aug 13 '26 15:08

Kevin Kelbie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!