我使用了ARIMAResults的plot_predict
函数来预测未来5年的数据,结果还算合理。唯一的问题是,我需要将这些预测出来的数据用在Power Bi中!
我该如何查看这些数值(而不是在图表上)?
注意:我正在使用Python语言!
谢谢!
predict()
方法而不是plot_predict()
。这两个方法基本相同,参数也一样,但predict()
将预测值作为数组返回,而plot_predict()
则返回一个图形。使用 predict() 代替 predict_plot()
print("Predicted Price pct change")
def plotARMA(df_accumulative,ax,label):
result=df_accumulative
result=result.rolling(window=45).mean().dropna()
mod = sm.tsa.arima.ARIMA(result, order=(2,0,0))
res = mod.fit()
# Plot the original series and the forecasted series
#res.plot_predict(start=0, end=400)
df_accumulative.plot(ax=ax,label=label)
res.predict().plot(ax=ax,label=label)
fig,ax = plt.subplots(figsize=(20,20))
plotARMA(duke_accumulative,ax,"Duke")
plotARMA(nee_accumulative,ax,"Next Era")
plotARMA(xel_accumulative,ax,"Xel")
plt.legend(fontsize=8)
plt.title("ARMA")
plt.show()
data = [ ... some data ...]
然后plot_predict(data)
。一旦你有了一个具体的例子,其他人就可以精确地给你解决问题的指导。 - Zephaniah Grunschlag