ARIMA Models in Python
James Fulton
Climate informatics researcher
from statsmodels.tsa.stattools import adfuller
results = adfuller(df['close'])
print(results)
(-1.34, 0.60, 23, 1235, {'1%': -3.435, '5%': -2.913, '10%': -2.568}, 10782.87)
print(results)
(-1.34, 0.60, 23, 1235, {'1%': -3.435, '5%': -2.863, '10%': -2.568}, 10782.87)
Difference: $\Delta y_t = y_t - y_{t-1}$
df_stationary = df.diff()
city_population
date
1969-09-30 NaN
1970-03-31 -0.116156
1970-09-30 0.050850
1971-03-31 -0.153261
1971-09-30 0.108389
df_stationary = df.diff().dropna()
city_population
date
1970-03-31 -0.116156
1970-09-30 0.050850
1971-03-31 -0.153261
1971-09-30 0.108389
1972-03-31 -0.029569
Examples of other transforms
np.log(df)
np.sqrt(df)
df.shift(1)/df
ARIMA Models in Python