pandas time series timestamp +/- (plus minus) hour for day light savings (dst)

677 Views Asked by At

In pandas, I've converted some of my dataset from US/Eastern and some from American/Chicago:

data_f1 = data_f[:'2007-04-26 16:59:00']
data_f1.index = data_f1.index.tz_localize('US/Eastern', infer_dst=True).tz_convert('Europe/London')
data_f2 = data_f['2007-04-26 17:00:00':]
data_f2.index = data_f2.index.tz_localize('America/Chicago', infer_dst=True).tz_convert('Europe/London')
data = data_f1.append(data_f2)

I have two questions about this.

(1) Does tz_convert() account for the DST changes between NY (or Chicago) time and London? Is there any documentation to support this? I couldn't find it anywhere.

(2) The output looks like this:

enter image description here

I'm not sure what the "+01:00" is at the end of the time stamp, but I think it has something to do with DST transitions? What is the + exactly relative to? I'm not sure what it means or why it's necessary - if I convert from US/Eastern 14:00 to Europe/London 19:00, it's simply 19:00, not 19:00+01:00? Why is that added?

When I output to Excel, I have to manually chop off the everything after the "+". Is there any option to simply not output it to begin with (unless it's actually important)?

Thanks for your help in advance!

UPDATE: The closest thing I've found to stripping the +'s is here: Convert pandas timezone-aware DateTimeIndex to naive timestamp, but in certain timezone but it seems like this may take a long time with a lot of data. Is there not a more efficient way?

1

There are 1 best solutions below

0
On BEST ANSWER

The way I used to solve this was to output to a .csv, read it back in (which makes it time zone naive but keeps the time zone it was in), then strip the +'s.