-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Timestamp constructor parses ISO 8601 incorrectly near DST boundaries #8225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Looking at this more closely, something is very wrong: In [1]: import pandas as pd
In [2]: pd.Timestamp('2013-11-03 01:30:00', tz='America/Havana')
Out[2]: Timestamp('2013-11-03 00:30:00-0500', tz='America/Havana') # BAD!
In [3]: pd.Timestamp('2013-11-03 1:30:00', tz='America/Havana')
Out[3]: Timestamp('2013-11-03 01:30:00-0500', tz='America/Havana') |
I can't reproduce this. I'm not on the bleeding edge, but not too many commits far behind.
Also, I think the string format up top is wrong. If you add spaces and a missing % you get it back correctly.
|
I see now that the issue is the short format even after adding the %. Let me take a look. |
So this works without the Z. Aren't Z and %z contradictory in that %z implies an offset but Z doesn't imply one?
|
You're right about the string format; I misread ISO 8601. The second issue persists for me, and I think it has to do with (EDIT: |
US/Eastern is my tz and that works fine as well and the same with tzlocal (I assume you were taking this from dateutil). |
Huh. I'm observing this issue on a build from source fetched about 36 hours ago. I edited the OP. If you try the test in the second box, what do you observe? |
Well this is fun. My versions are a few weeks old. I can check later tonight whether the behavior persists when I update.
Further, I agree that an error should be thrown when you pass in a non-ISO8601 format. Clearly it thought it could parse it when in fact it shouldn't be able to. |
Okay, I can reproduce when I update my code. So something was introduced between 14.1 and the latest commit to cause a different behavior. What is the right behavior here? I agree that it should be consistent but I'm not sure what the right behavior is. I suppose a consistent offset across the cases would be the right thing here as there is nothing to differentiate those times.
|
I would support an |
@ischwabacher @rockg either you guys have a chance to look at this? |
I tried a little while ago and was stymied by not being able to get cygdb to run. I'll give it another shot tonight. |
@ischwabacher It may be worth running a git-bisect as something changed between 14.1 where the issue doesn't exist and master where it does. That would help narrow down the problem area. |
|
TIL why you squash. |
this is still a problem, seems to alter hours between 2 and 6 on spring forward and hours between 2 and 5 on fall back:
|
Oh, I totally forgot about this. I did bisect it and found the commit with the bug, but I never found the bug itself. At the very least I will post the SHA-1 when I have a moment. |
...and I forgot to do this. The problem is in 6732306, presumably somewhere in parse_iso_8601_datetime, which is a horrible function. Why on earth would you handle "now" and "today" in your ISO8601 parsing code? Whyyy? |
closing as is dupe of #11481 (simpler discussion :) |
@ischwabacher yeh, the parsing should actually be before, though this DOES make it much faster I suspect. |
Original post, edited to correct ISO 8601 formats. The originally titled bug does not exist. There is, however, some unexpected behavior:
However, in the process of investigating this issue, I encountered the following, which is definitely a bug:
I'm not sure what's going on here.
The text was updated successfully, but these errors were encountered: