pythondataframeseaborn

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 with my dataframe Data

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

Solution

  • 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")