【发布时间】:2020-02-20 18:22:27
【问题描述】:
df.head():
start_date end_date
0 03.09.2013 03.09.2025
1 09.08.2019 14.05.2020
2 03.08.2015 03.08.2019
3 31.03.2014 31.03.2019
4 02.02.2015 02.02.2019
5 21.08.2019 21.08.2024
当我执行 df.tail() 时:
start_date end_date
30373 2019-07-05 00:00:00 2023-07-05 00:00:00
30374 2019-06-11 00:00:00 2023-06-11 00:00:00
30375 19.01.2017 2020-02-09 00:00:00 #these 2 start dates are just same as in head
30376 11.12.2009 2011-12-11 00:00:00
30377 2019-07-30 00:00:00 2023-07-30 00:00:00
当我这样做时
df[start_date] = pd.to_datetime(df[start_date])
某些日期将月份转换为天。 通过列格式不一致。如何正确转换?
【问题讨论】:
标签: pandas datetime type-conversion