Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pandas tz_convert: difference among EST, US/Eastern and America/New_York

It is my understanding that EST, US/Eastern and America/New_York should be the same, but apparently I was wrong.

when I do the following:

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

which gave:

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

when I do:

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

it gives:

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

when I do:

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

it gives:

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

could anyone give me some insight about this? I need to convert my timestamp so that it will be comparable with time for NYSE. Now I don't know which timezone to use. Thank you for your help.

There is a typo in my code (thanks, BrenBarn), so timezone: America/New_York and US/Eastern are actually the same.

like image 462
user6396 Avatar asked Nov 28 '14 06:11

user6396


People also ask

How do I remove timezone from datetime index?

To remove timezone from tz-aware DatetimeIndex , use tz_localize(None) or tz_convert(None) . tz_localize(None) will remove timezone holding local time representations.


2 Answers

I believe during that season, the U.S. is in day light saving time. According to this website:

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

U.S. use EST in winter and EDT in summer.

and

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

In 2011, day light saving starts from March 13th until November 6th.

like image 135
Frank Chen Avatar answered Nov 15 '22 04:11

Frank Chen


EST specifically refers to Eastern Standard Time, but the date you have chosen is during Daylight Savings Time.

Other than that, your examples will give the correct result if you use the same offset for all. You're using -0400 in some but -4000 in others (maybe due to a typo).

like image 4
BrenBarn Avatar answered Nov 15 '22 02:11

BrenBarn