You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在IPython中查看绘图?执行绘图代码后无显示的解决办法

解决Pandas绘图不显示的问题

修复步骤

  • 若使用Jupyter Notebook/JupyterLab:
    1. 在代码开头添加魔法命令开启自动绘图显示:
      %matplotlib inline
      
    2. 或者在绘图代码后显式调用Matplotlib的显示函数:
      import matplotlib.pyplot as plt
      df.set_index('ds').plot()
      plt.show()
      
  • 若使用普通Python脚本:
    必须导入Matplotlib并调用plt.show()来弹出绘图窗口,完整代码示例:
    import pandas as pd
    import matplotlib.pyplot as plt
    
    df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_pedestrians_covid.csv')
    df.set_index('ds').plot()
    plt.show()
    

参考文档内容翻译

将新冠疫情封锁作为一次性节假日处理
在处理冲击事件时,我们可将新冠疫情封锁期视为一次性节假日进行建模,以此捕捉这类事件对时间序列数据(如本例中的行人流量)的影响。通过这种方式,Prophet能更好地拟合包含突发冲击的时间序列,提升预测准确性。

内容的提问来源于stack exchange,提问作者nz_21

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 11:22:04