JA-*_*sta 0 python matplotlib dataframe python-3.x seaborn
我正在尝试与seaborn 一起绘制line plot。
使用:
sns.relplot(Data, x="InvoiceYearMonth", y="price", hue="company")
Run Code Online (Sandbox Code Playgroud)
给我一个错误:
TypeError: relplot() got multiple values for argument 'x'
Run Code Online (Sandbox Code Playgroud)
可能出什么问题了?
这是我的数据样本供您参考:
InvoiceYearMonth company price
0 202001 companyA 1509.40
1 202001 companyB 469.00
2 202001 companyC 358.81
3 202002 companyD 870.00
4 202002 companyE 465.58
5 202002 companyF 563.00
6 202003 companyG 1140.00
Run Code Online (Sandbox Code Playgroud)
您双重指定x: 首先作为位置参数(它设置x为Data,然后是命名参数x(设置x为"InvoiceYearMonth")。
试试这个:
sns.relplot(data=Data, x="InvoiceYearMonth", y="price", hue="company")
Run Code Online (Sandbox Code Playgroud)