[英]How do I change the date format from 01-Mar-19 to 2019-03-01 in pandas?
I have 01-Mar-19 but I need it in 2019-03-01 format I have tried result = pd.to_datetime(dates)我有 19 年 3 月 1 日,但我需要 2019 年 3 月 1 日的格式我已经尝试过 result = pd.to_datetime(dates)
You need to specify the input format for the date with the format
parameter:您需要使用
format
参数指定日期的输入格式:
pd.to_datetime(df["date"], format="%d-%b-%y")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.