如何在Streamlight中显示预测图形图

2024-06-13 12:27:21 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用Streamlight进行可视化。我的内容之一是预测如下图形: enter image description here使用jupyter笔记本中的此代码

pred_uc = results.get_forecast(steps=100)
pred_ci = pred_uc.conf_int()
ax = y.plot(label='observed', figsize=(14, 7))
pred_uc.predicted_mean.plot(ax=ax, label='Forecast')
ax.fill_between(pred_ci.index,
                pred_ci.iloc[:, 0],
                pred_ci.iloc[:, 1], color='k', alpha=.25)
ax.set_xlabel('Month')
ax.set_ylabel('Harga USD')
plt.legend()
plt.show()

但是当我尝试使用streamlight时,我会像这样稍微修改代码

  pred_uc = results.get_forecast(steps=100)
    pred_ci = pred_uc.conf_int()
    ax = y.plot(label='observed', figsize=(14, 7))
    pred_uc.predicted_mean.plot(ax=ax, label='Forecast')
    ax.fill_between(pred_ci.index,
                pred_ci.iloc[:, 0],
                pred_ci.iloc[:, 1], color='k', alpha=.25)
    forecast = pred_uc.predicted_mean
    st.write(forecast)
    st.line_chart(forecast)

结果是这样的 enter image description here

请给我一个解决方案!先谢谢你


Tags: 代码cigetplotconfaxstepsmean