-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: iterator of DatetimeIndex broken with tzoffset timezone #8890
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
Can you provide a small reproducible example that shows the problem? Because I don't see a problem if I run the following:
And I get the same in 0.15 as 0.13. |
@jorisvandenbossche Thanks for the reply. Here is what I have:
with values:
And when I try to do:
it returns:
This wasn't the case in 0.13 and I can still run it in that version without a problem. So the only thing I can attribute it to is a version change in pandas. |
pd.show_versions() in 0.13.1 (and 0.15.1) pls show how you constructed this |
The line right before this, which makes
I have traced it line by line and everything up to that point is the same. Unfortunately, I can't post how the Here is the output of versions in two pandas:
and for Pandas 0.15.1:
|
The trigger is the
|
Thank you. So it would seem Pandas sees |
This is a regression from 0.14 |
Summary:
The trigger is the
tzoffset
timezone. This bug can be reproduced as follows:In 0.14 this last comparison gives True.
This appears in iterating over the index (
for time in index: ...
) or with usingDataFrame.iterrows()
(#8951).Original report:
I see there are a number of issues related to datetime and timeindex here in issues, and I suspect that mine has a lot in common with them. The cure for one of them will probably solve all of them. So here it goes.
My code was using Pandas 0.13.1 without an issue. I recently upgraded to 0.15.1
This is where my code acts unexpectedly:
The index is in US/Pacific timezone. When the for loop returns
time
, it is still in US/Pacific timezone but with an added 8h to the time. So, while the actual time is2014-11-23 23:25:02.916000-08:00
,time
is set to2014-11-23 15:49:12.972000-08:00
.I have made sure that the type of index is
pandas.Timestamp
and I can't find an elegant workaround that would ensure running it in both versions of Pandas.Any thoughts on this?
The text was updated successfully, but these errors were encountered: