' str'在绘制预测值的图表中,对象不可呼应

发布于 2025-02-05 05:35:24 字数 621 浏览 1 评论 0原文

在使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文