' str'在绘制预测值的图表中,对象不可呼应
在使用matplotlib.pyplot分配标题的同时,错误会弹出“ str”对象。这是代码,可视化预测的股票价格:
plt.title("Predicted Price for next 50 days")
plt.xlabel("Days")
plt.ylabel("Price")
plt.plot(ypred)
运行上述代码时会弹出以下错误:
<ipython-input-55-cb835b209acc> in <module>
1 plt.figure(figsize = (12, 6))
----> 2 plt.title("Predicted Price for next 50 days")
3 plt.xlabel("Days")
4 plt.ylabel("Price")
5 plt.plot(ypred)
TypeError: 'str' object is not callable
<Figure size 864x432 with 0 Axes>
当我评论第1-3行时,它会绘制线路图。每当我尝试将任何行变成代码时,上面的消息都会再次弹出。
如何标记轴和图?
While assigning title using matplotlib.pyplot, an error pops up that 'str' object is not callable. Here is the code, visualising predicted stock prices:
plt.title("Predicted Price for next 50 days")
plt.xlabel("Days")
plt.ylabel("Price")
plt.plot(ypred)
The following error pops up when the above code is run:
<ipython-input-55-cb835b209acc> in <module>
1 plt.figure(figsize = (12, 6))
----> 2 plt.title("Predicted Price for next 50 days")
3 plt.xlabel("Days")
4 plt.ylabel("Price")
5 plt.plot(ypred)
TypeError: 'str' object is not callable
<Figure size 864x432 with 0 Axes>
When I comment lines 1-3, it plots a line graph. Whenever I try to turn any line into code, the above message pops up again.
How do I label the axis and graph?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论