gpt4 book ai didi

python - pandas tz_convert : difference among EST, 美国/东部和美洲/纽约

转载 作者:太空宇宙 更新时间:2023-11-03 13:42:48 24 4
gpt4 key购买 nike

我的理解是 EST、US/Eastern 和 America/New_York 应该是一样的,但显然我错了。

当我执行以下操作时:

pd.Timestamp('2011-07-03T07:00:00-04:00').tz_convert('US/Eastern')

给出了:

Timestamp('2011-07-03 07:00:00-0400', tz='US/Eastern')

当我这样做时:

pd.Timestamp('2011-07-03T07:00:00-04:00').tz_convert('EST')

它给出:

Timestamp('2011-07-03 06:00:00-0500', tz='EST')

当我这样做时:

pd.Timestamp('2011-07-03T07:00:00-40:00').tz_convert('America/New_York')

它给出:

Timestamp('2011-07-04 19:00:00-0400', tz='America/New_York')

谁能给我一些关于这方面的见解?我需要转换我的时间戳,以便它可以与纽约证券交易所的时间进行比较。现在我不知道要使用哪个时区。感谢您的帮助。

我的代码中有一个拼写错误(感谢 BrenBarn),所以时区:America/New_York 和 US/Eastern 实际上是相同的。

最佳答案

我相信在那个季节,美国正处于夏令时。根据这个网站:

http://www.timeanddate.com/time/zones/est

美国冬季使用 EST,夏季使用 EDT。

http://www.timeanddate.com/time/dst/2011.html

2011 年,夏令时从 3 月 13 日开始至 11 月 6 日。

关于python - pandas tz_convert : difference among EST, 美国/东部和美洲/纽约,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27183000/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com