简体   繁体   中英

Pandas showing wrong datetime format in seaborn plot

I have a problem to show datetime format in 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.

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. Its format is shown 2020-01-22T00:00:00.000000000

How can I fix it?

解决方案

pd.to_datetime(df.columns[1:]).date.tolist()

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