【发布时间】:2021-03-03 05:08:45
【问题描述】:
我正在尝试用每列一条线绘制线图。我的数据集如下所示:
我正在使用此代码,但它给了我以下错误: ValueError: 传递的项目数错误 3,位置暗示 27
plot_x = 'bill__effective_due_date'
plot_y = ['RR_bucket1_perc', 'RR_bucket7_perc', 'RR_bucket14_perc']
ax = sns.pointplot(x=plot_x, y=plot_y, data=df_rollrates_plot, marker="o", palette=sns.color_palette("coolwarm"))
display(ax.figure)
也许这是一个愚蠢的问题,但我是 python 新手,所以我不知道该怎么做。这是我的预期输出:
谢谢!!
【问题讨论】:
-
你好像在找
sns.lineplot() -
如果你不介意不使用 seaborn,在 Pandas 中很简单:
df_rollrates_plot.plot(x = plot_x, y = plot_y)。另外,请确保您已将日期解析为日期(阅读表格时,请使用read_csv中的parse_dates="bill__effective_due_date"选项。