-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
index.levels not being updated by groupby #2655
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
Workaround is index.get_level_values(2).unique() (I think?), so maybe index.levels is obsolete API? |
I'm not convinced that discarding other reference values for the "categorical variable" by default is correct. kicking this can down the road; I would use the workaround for now when you need to know the actual observed level values in a chunk of the data |
So, the groupby problem in #2770 shows that there is a lurking bug, no? Deleted lines should not appear anymore. Does that mean that the groupby algorithm uses index.levels instead of working with the index or index.get_level_values? |
10 month down the road can-kicking enough? |
Right now, I don't consider this a bug. Can you help me understand why an end user needs to care about what is actually in the levels? To be clear, if we don't update them, we can share the levels indexes between all the views and copies of this MI, instead of allocating new ndarrays (and hash tables?) for each. I could see adding a method to allow consolidation of a MultiIndex, but you can get the same thing now by doing: new_index = MultiIndex.from_tuples(index.values) |
See #2770 (comment). That's not what levels is for. Edit: It should be
Which does an extra copy (or two). |
Summary:
Input:
Operation:
Output:
Details:
http://nbviewer.ipython.org/4482106/
The text was updated successfully, but these errors were encountered: