【问题标题】:TypeError: unhashable type: 'numpy.ndarray'-arima time seriesTypeError: unhashable type: 'numpy.ndarray'-arima 时间序列
【发布时间】:2019-12-06 22:24:14
【问题描述】:

尝试绘制二维表但出现错误

我的表只有 2 列,代码是:

Combined = pd.read_csv(file_path, parse_dates=['Revenue_mth'], index_col = ['Revenue_mth'])
plt.xlabel('Date')
plt.ylabel('Revenue amount')
plt.plot(Combined)

【问题讨论】:

  • 请张贴几行您的输入 (file_path) 并添加 pandas 标签。

标签: python python-3.x pandas matplotlib


【解决方案1】:

Combined 是数据框,您必须在绘图命令中指定列。

 Combined = pd.read_csv(file_path, parse_dates=['Revenue_mth'], 
                        index_col = ['Revenue_mth'])
 plt.xlabel('Date')
 plt.ylabel('Revenue amount')
 plt.plot(Combined['Revenue_mth'],Combined['Column 2'])
 plt.show()

“第 2 列”是另一列的标题名称。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-03
    • 2021-08-31
    • 1970-01-01
    • 2019-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多