Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
pd.to_datetime("2015-11-18 15:30:00+05:30").tz_localize('UTC').tz_convert('Asia/Kolkata') returns '2015-11-18 16:30:00+0530' #11708
Comments
|
pls show your versions of pytz and dateutil |
PShiw
commented
Nov 26, 2015
|
I am using Python 3.4.3 pytz Version:- 2015.7 dateutil version :- 2.4.2 |
|
This is somewhat similar to #11481. As you see below, the tzinfo.utcoffset gets intepreted as 4:30 (I put in print statements to help debug) and so your subsequent operations are off. This is a bug as far as I'm concerned.
|
jreback
added Bug Timezones
labels
Nov 27, 2015
jreback
added this to the
Next Major Release
milestone
Nov 27, 2015
|
And notice that if I remove the "0" in front of the offset, it works correctly as it goes into the dateutil parser (again the extra output is for debugging purposes).
|
PShiw
commented
Nov 28, 2015
|
Please note that "o" in time stamp was returned by Pandas only. For details refer below code.
|
|
Needs to look more, but the below line looks problematic. After the change, we get:
|
|
I agree that does look suspicious and that you should be adding and not subtracting. I guess we have no tests with a tzoffset that contains minutes? |
|
Further confirmed with an even better example: With subtraction:
With addition:
I'll open up a PR. |
rockg
referenced
this issue
Dec 6, 2015
Merged
BUG: Parsing offset strings with non-zero minutes was incorrect #11774
jreback
modified the milestone: 0.18.0, Next Major Release
Dec 6, 2015
jreback
closed this
in #11774
Dec 7, 2015
jreback
added a commit
to mroeschke/pandas
that referenced
this issue
Apr 8, 2017
|
|
jreback |
a7ee890
|
jreback
added a commit
that referenced
this issue
Apr 8, 2017
|
|
mroeschke + jreback |
f35209e
|
linebp
added a commit
to linebp/pandas
that referenced
this issue
Apr 17, 2017
|
|
mroeschke + linebp |
8743970
|
PShiw commentedNov 26, 2015
running "pd.to_datetime("2015-11-18 15:30:00+05:30").tz_localize('UTC').tz_convert('Asia/Kolkata')" returns following o/p
Timestamp('2015-11-18 16:30:00+0530', tz='Asia/Kolkata')
It should have returned as Timestamp('2015-11-18 15:30:00+0530', tz='Asia/Kolkata') as no daylight saving is applicable in India.