【发布时间】:2019-03-23 20:57:09
【问题描述】:
我有以下熊猫系列数据::
print(times)
给予
1 2017-07-23T00:26:50Z
3 2017-07-31T04:07:24Z
6 2017-07-18T15:09:20Z
8 2017-07-12T05:24:14Z
...
12353 2017-07-12T18:34:48Z
12355 2017-08-01T22:27:42Z
12356 2017-07-11T03:36:44Z
我只是想将这些 UTC 时间戳转换为秒或
from astropy.time import Time
t = pd.Timestamp(times)
只是给出一个
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-320d28559d92> in <module>()
----> 1 t = pd.Timestamp(times)
pandas/_libs/tslibs/timestamps.pyx in
pandas._libs.tslibs.timestamps.Timestamp.__new__()
pandas/_libs/tslibs/conversion.pyx in
pandas._libs.tslibs.conversion.convert_to_tsobject()
TypeError: Cannot convert input [1 2017-07-23T00:26:50Z
我真的不明白发生了什么。
【问题讨论】:
-
时间戳前的第一个数字是多少? -->1 2017-07-23T00:26:50Z
-
我认为这只是 pandas/jupyter 的行号。
-
我不知道如何摆脱它......
标签: python pandas timestamp unix-timestamp utc