【发布时间】:2020-05-20 19:18:59
【问题描述】:
在 pandas 中,我们如何从这些数据中创建日期时间列?
df = pd.DataFrame({'date': ['2020-02-04T22:03:44.846000+00:00']})
print(df)
date
0 2020-02-04T22:03:44.846000+00:00
我不确定这里的字母“T”是什么。
尝试
pat = '%y-%m-%dT%H:%M%:%SZ'
df['date'] = pd.to_datetime(df['date'],format=pat)
I am not sure what is the correct format here.
【问题讨论】:
-
@Felipe,谢谢我明白了,但现在正在努力正确的日期时间格式。