我有一个包含时间戳的数据框,其数据类型为对象。
0 2020-07-09T04:23:50.267Z
1 2020-07-09T11:21:55.536Z
2 2020-07-09T11:23:18.015Z
3 2020-07-09T04:03:28.581Z
4 2020-07-09T04:03:33.874Z
Name: timestamp, dtype: object
我不知道上面的数据框中日期时间的格式。我对上述列应用了 pd.to_datetime,其中数据类型被更改为 datetime64[ns, UTC]。
df['timestamp'] = pd.to_datetime(df.timestamp)
现在数据框的外观如下:
0 2020-07-09 04:23:50.267000+00:00
1 2020-07-09 11:21:55.536000+00:00
2 2020-07-09 11:23:18.015000+00:00
3 2020-07-09 04:03:28.581000+00:00
4 2020-07-09 04:03:33.874000+00:00
Name: timestamp, dtype: datetime64[ns, UTC]
我想将上述的 datetime64[ns, UTC] 格式转换为普通日期时间格式。
For example,
2020-07-09 04:23:50.267000+00:00 to 2020-07-09 04:23:50
有人能解释一下这个2020-07-09T04:23:50.267Z表示的含义吗?还有如何将其转换为日期时间对象?
2020-07-09T04:23:50.267Z
是一个 ISO8601 的日期/时间字符串。Z
代表的是 Zulu 时间,意味着协调世界时(UTC)。 - FObersteiner