[英]Pandas showing wrong datetime format in seaborn plot
I have a problem to show datetime format in seaborn.我在 seaborn 中显示日期时间格式时遇到问题。
Here is my dataframe shown below这是我的数据框如下所示
Country Date Count_1 Count_2 Count_3
Australia 2020-01-22 0 0 0
Canada 2020-01-22 2 1 3
... ... ... .. ...
I changed the format of Date as shown below.我更改了 Date 的格式,如下所示。
df['Date'] = pd.to_datetime(df['Date'], format='%Y-%m-%d')
df.rename(columns={'Date': 'Day_Date'}, inplace=True)
When I draw a seaborn graph, Day_date
cannot be intended format.当我绘制 seaborn 图时,
Day_date
不能是预期格式。 Its format is shown 2020-01-22T00:00:00.000000000
其格式显示为
2020-01-22T00:00:00.000000000
How can I fix it?我该如何解决?
解决方案
pd.to_datetime(df.columns[1:]).date.tolist()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.