我有以下数据框:
Month Year Location Revenue
0 2015-01 Location 1 0.00
1 2015-03 Location 1 1105.50
2 2015-04 Location 1 44034.28
3 2015-05 Location 1 56756.39
4 2015-06 Location 1 51502.22
大约有两年的数据价值。有5个不同的位置。我想创建一个带有seaborn的线图,该线图显示5条不同的线(每个位置一条线),其中y轴为收入,x轴为月年。
sns.lineplot(x="Month Year",
y="Revenue",
hue="Location",
data=rev_by_month,
palette="tab10")
但是,当我运行上面的代码时,出现以下错误:
视图下限最小值-0.05500000000000001小于1,并且是无效的Matplotlib日期值。如果您将非datetime值传递给具有datetime单位的轴,通常会发生这种情况
作为记录,使用熊猫.to_datetime()函数创建了Month Year列。