-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
tz info lost when creating multiindex #3950
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
that is a gnarly one-liner there. i get an exception on the index assignment |
Ah, you're right. Tried to be too clever there. (fixed) |
This problem also occurs with groupby operations that create multiple indexes with time zones. For example:
We start out with timezones:
However, if we do a groupby on multiple columns, we will lose the timezones:
|
We just upgraded to pandas 0.14, and the groupby/pivot bugs related to losing tz-info have been fixed. However, reset_index of a MultiIndex still loses tz-info.
And, column assignment still loses tz-info.
|
cc @sinhrks take a look? |
Yeah, I think |
We just upgraded to pandas 0.14.1, and the reset_index no longer loses tz-info. Thanks for fixing that! However, it still seems that column assignment loses tz-info
|
this is by definition, you are passing a dictionary, where things are coerced. I supposed one might consider this is a bug. I'll create a separate issue Their are several ways to do this in any event.
or
|
Thanks for creating the new issue and giving other solutions. When testing the 0.14.1 on old code, I ran into the follow crash when using reset_index with tz-aware data in a multi-index.
Note that if we don't set a tz, it seems to work fine.
|
That last is already fixed here: #7533 |
see http://stackoverflow.com/questions/17159207/change-timezone-of-date-time-column-in-pandas-and-add-as-hierarchical-index/17159276#17159276
If we add another index (we lose the tz):
The text was updated successfully, but these errors were encountered: