from statsmodels.tsa.stattools import adfuller
result = adfuller(testvar)
print('ADF Statistic: %f' % result[0])
print('p-value: %f' % result[1])
print('Critical Values:')
for key, value in result[4].items():
print('\t%s: %.3f' % (key, value))
print()
print('Nullhypothese H0: Zeitreihe ist nicht-stationär (random walk)')
print('Verwerfen, wenn ADF > Critical value bei 5%')
print('Verwerfen mit 5% Fehlerwahrsch. ist:', result[0]>result[4]["5%"])
print()
printmd('*A random walk is one in which future steps or directions cannot be predicted \
on the basis of past history. The human mind sees patterns everywhere and we must be \
vigilant that we are not fooling ourselves and wasting time by developing elaborate \
models for random walk processes. (Jason Brownlee 2018)*')
print()