【发布时间】:2014-10-28 11:56:46
【问题描述】:
我在数据框中有以下内容:
> df['timestamps'].loc[0]
Timestamp('2014-09-02 20:24:00')
我知道它使用的时区(我认为是GMT),并希望将整个列转换为EST。如何在 Pandas 中做到这一点?
作为参考,我发现了这些其他线程:
- Changing a unix timestamp to a different timezone
- Pandas: Read Timestamp from CSV in GMT then resample
但它们使用datetime 时间戳。例如:
> datetime.datetime.fromtimestamp(df['timestamps'].loc[0], tz=None)
returns:
TypeError Traceback (most recent call last)
----> 2 datetime.datetime.fromtimestamp(ts, tz=None)
TypeError: an integer is required (got type Timestamp)
【问题讨论】: