Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
date_range does not capture right timezone from input dates #7901
Comments
jreback
added Bug Timezones
labels
Aug 2, 2014
|
is this the same as #7835 ? |
|
Now that I look more closely, it probably is. I'd prefer to leave it open for some additional test cases at least. |
jreback
added this to the
0.15.0
milestone
Aug 2, 2014
This was referenced Aug 2, 2014
|
The 3.4 test failed and it's because Timestamp vs datetime result in different offsets. I recall seeing this a few days ago in one of the issues but can't easily find it. Any ideas what's going on?
|
|
FWIW, this is what I see using 64-bit Python 3.4.1 on Windows, with pytz 2014.4:
I don't know if it has anything to do with anything, but I just noticed that there's no egg for 3.4 on https://pypi.python.org/pypi/pytz. |
|
And I don't know how this particular test test_daterange.py(TestDateRange.test_range_tz_pytz) ever passes on 3.4 (I didn't add it and my change doesn't impact it). |
|
@rockg |
|
I don't understand completely what that means. Is this a bug in itself (why does the Timestamp have a different offset than the datetime) or are they doing something different with pytz? |
|
Shoud use
Before your fix, both |
|
@sinhrks Why would this only have to happen for 3.4? All other versions of tests passed fine. And I swear that I tried localize to the same effect, but you show otherwise...I will confirm later this evening. |
|
In my understanding, the issue is caused by |
|
if its with You have to be very explicit with the expected case, iow, you have to normalize it correctly. Their were a few cases that 'worked' because 3.4 fails because it uses the current pytz. the others use a definition that has < 2014.3 pytz |
|
@rockg what do you you mean passing in 'tzinfo' is not enough? you ALWAYS have to localize |
|
I know, but the pandas tests themselves don't localize (and I'm sure other people have done the same thing and it was fine until the latest release of pytz). |
|
no, the pandas tests are WRONG if they don't localize. I appreciate that you want to fix the docs, ok. But pandas tests themselves need to be fixed if they are wrong (as some were when we shifted to 2014.3) |
|
That's what I'm saying...the pandas tests are wrong. Of course I'm going to fix the tests in addition to the docs. |
|
@rockg perfect, thanks! and a doc-warning (actually in the timezone section) might not be a bad idea as well. |
|
I don't think the user should ever have to call Again, I am strongly in favor of a view of time zones as immutable objects, at least modulo the ability of governments to screw up our predictions of the future. |
jreback
closed this
in #7909
Aug 5, 2014
jreback
added a commit
that referenced
this issue
Aug 5, 2014
|
|
jreback |
7568018
|
rockg commentedAug 2, 2014
Example is below. I would expect that if dates have a timezone on them, date_range would then use that timezone to fill in the rest of the period. However, something goes awry (notice the 01:00 below). If I have dates with a timezone and pass a timezone (case 2), it still doesn't work. Only when I remove the timezone from the dates does it work (case 3). I would expect all these to work the same.