【问题标题】:How to plot timeseries graph with pandas dataframe [duplicate]如何使用熊猫数据框绘制时间序列图[重复]
【发布时间】:2021-07-12 10:33:52
【问题描述】:
0          1
0 2019-08-06   1.264652
1 2019-08-10   4.136145
2 2019-08-15  18.981240
3 2019-08-20  15.608667
4 2019-09-07   4.108212

我有一个像这样的 pandas 数据框,我想根据这个绘制一个时间序列图,我该怎么做。

这就是我正在做的。

df = pd.DataFrame(DATA_LIST)
    print(df.head())
    df.plot()
    plt.show()

但我需要 X 轴上的日期值。

【问题讨论】:

标签: pandas dataframe matplotlib


【解决方案1】:
 df.plot(x="name of the column with dates", y="name of the column with dates")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-10-18
    • 2021-02-12
    • 1970-01-01
    • 1970-01-01
    • 2018-02-10
    • 2017-06-09
    • 1970-01-01
    相关资源
    最近更新 更多