Andreas Parasian
Andreas Parasian

Reputation: 23

Why Seaborn could not interpret the inputted column when plotting scatter/lineplot?

I am trying to make a visualization of Italy's Covid-19 data. However, when I tried to use Seaborn's scatterplot in visualizing my data, it couldn't interpret the inputted column even though I had made sure the column is not the dataframe's index.

Below is the screenshot:

Code and error message

Below is the data:

Italy_data.xlsx Gdrive Drive File

So what I want to do is that I want to visualize the rising number of cumulative deaths and cases based on the date/timestamp on the column of "Converted_Date_reported".

Upvotes: 2

Views: 342

Answers (1)

r-beginners
r-beginners

Reputation: 35135

The cause is that the column name contains a space character at the beginning. If you include it, the error will not occur. You should do some data maintenance before that.

g = sns.lineplot(x=df['Converted_Date_reported'], y=df[' Cumulative_cases'], data=df)

enter image description here

enter image description here

Upvotes: 2

Related Questions