简体   繁体   中英

How to fix: TypeError: relplot() got multiple values for argument 'x' when plottling a line plot with seaborn

I am trying to plot a line plot with seaborn.

Using:

sns.relplot(Data, x="InvoiceYearMonth", y="price", hue="company")

Gives me an error:

TypeError: relplot() got multiple values for argument 'x'

What could be wrong?

Here is a sample of my data for your reference:

    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

You double specified x : first as positional parameter (it sets x to Data , then a named parameter x (setting x to "InvoiceYearMonth" ).
Try this:

sns.relplot(data=Data, x="InvoiceYearMonth", y="price", hue="company")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM