简体   繁体   中英

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".

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)

在此处输入图像描述

在此处输入图像描述

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