python - ValueError:使用 plt.show() 时第 0 年超出范围
问题描述
我是 python 新手,我尝试绘制图表,但它一直给我一个错误,说“ValueError:第 0 年超出范围”。有人知道我的代码发生了什么吗?你能给我一些关于如何解决它的建议吗?非常感激!
下面是 actual_predictions 值的截图: 在此处输入图片描述
下面是 x 值的截图: 在此处输入图片描述
下面是绘制图形的代码:
plt.title('Month vs total diverted')
plt.ylabel('Total total diverted')
plt.grid(True)
plt.autoscale(axis='x', tight=True)
#import pdb; pdb.set_trace()
plt.plot(df['Total_Surface_Water_Diverted'][-train_window:])
plt.plot(x,actual_predictions)
plt.show()
解决方案
推荐阅读
- javascript - 将大型 JSON 文件保存到 MySQL 时性能更好
- sql - 如何返回最大滚动平均值的日期范围?
- laravel - 带有选择框 Laravel 的表单的 POST 请求
- php - 防止机器人夸大我的读取/命中计数?
- jpa - 如何在 JPA 中创建包含属性的关系?
- python - RSA公钥大小python
- php - 使用 wp_audio_shortcode 的 Wordpress 音频
- android - Google Fit 多久在不同设备之间同步一次数据以及它们如何同步?
- unity3d - Unity 和 vuforia 无法生成 3D 角色
- arrays - 从带有字符串的数组中快速调用项目