Skip to content

0.15.2: Iteration over datetime index #9100

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

Closed
Oxtay opened this issue Dec 17, 2014 · 2 comments · Fixed by #9104
Closed

0.15.2: Iteration over datetime index #9100

Oxtay opened this issue Dec 17, 2014 · 2 comments · Fixed by #9104
Labels
Bug Datetime Datetime data dtype
Milestone

Comments

@Oxtay
Copy link

Oxtay commented Dec 17, 2014

When iterating over a Series of datetime objects that have timezone info on them, the returned value has the timezone info but also alters the time according to that timezone info, as seen in example below:

time_points is the index of a dataframe with values:

[2014-12-01 03:32:39.987000-08:00, ..., 2014-12-01 04:12:34.987000-08:00]
Length: 4, Freq: None, Timezone: tzoffset(None, -28800)
2014-12-01 03:32:39.987000-08:00
2014-12-01 03:52:38.987000-08:00
2014-12-01 04:02:36.987000-08:00
2014-12-01 04:12:34.987000-08:00 

However, for the following command:

for time in time_points:
    print time

the output is:

2014-12-01 11:32:39.987000-08:00
2014-12-01 11:52:38.987000-08:00
2014-12-01 12:02:36.987000-08:00
2014-12-01 12:12:34.987000-08:00
@Oxtay
Copy link
Author

Oxtay commented Dec 17, 2014

This looks suspiciously like the other issue I reported #8890, which was the inverse of this problem. So It might not have been a real bug in the first place. Or it was resolved in some other way and the fix made it resolved twice. :) @jorisvandenbossche @jreback

@jreback
Copy link
Contributor

jreback commented Dec 18, 2014

@Oxtay so the value of the Timestamp was fixed by the prior issue, but when constructed in this particular way the tz was not (and hence the hour was off). I think it was just a slightl difference in how datetimes and Timestamp are constructed from the underlying c-structure (for this type of time zone). Fixed up now. thanks for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants