这在某种程度上是前一篇文章的延续,但我正试图预测每周的收入。我的程序似乎还在进行更大胆的测试。它以前运行过,通过p值看上去是静止的,但并不是一致的.我也添加了SARIMAX,代码只是挂起。如果我取消了,我会收到一条(定期)底部的消息,上面说问题是不受约束的。
数据:
Week | Week_Start_Date |Amount |year
Week 1 2018-01-01 42920 2018
Week 2 2018-01-08 37772 2018
Week 3 2018-01-15 41076 2018
Week 4 2018-01-22 38431 2018
Week 5 2018-01-29 101676 2018代码:
x = organic_search.groupby('Week_Start_Date').Amount.sum()
# Augmented Dickey-Fuller test
ad_fuller_result = adfuller(x)
print(f'ADF Statistic: {ad_fuller_result[0]}')
print(f'p-value: {ad_fuller_result[1]}')
# SARIMA Model
plt.figure(2)
best_model = SARIMAX(x, order=(2, 1, 1), seasonal_order=(2, 1, 1, 52)).fit(dis=1)
print(best_model.summary())
best_model.plot_diagnostics(figsize=(15,12))我只工作185行左右。我不明白为什么代码会被挂起来。欢迎任何优化建议(对于adfuller和SARIMAX)。
发布于 2021-08-23 16:45:30
通过通过有机搜索“量”代替organic_search.groupby('Week_Start_Date').Amount.sum()来修正
https://stackoverflow.com/questions/68877451
复制相似问题