-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Let MultiIndex accept a list-like as input #23887
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
The arrays/dictionary initialization would be covered in the from_data proposal from this PR: #23141. Although pd.MultiIndex.from_arrays/from_tuples would already cover list-like input. @jreback / @toobaz / @TomAugspurger - does this add any merit to from_data over the dedicated from_frame? |
I'm confused here...don't we already have |
the proposal to make the default constructor to this |
@gfyoung , Yes, basically the proposal is to default constructor accept the arguments from |
@topper-123 : Yep, that makes sense. +1 from me. |
I don't think this makes sense. The default There is no iron-clad rule that a class's repr needs to use its constructor directly -- we could make the repr show If you did go ahead with this, what would you do with the existing constructor? Would you delegate the existing constructor to another method, or would you simply overload the first argument |
In #22511 and #23752 I work on some changes to
MultiIndex
. It came up in discussion that the consteuction of MultiIndex shold be changed, so that initialising with a list of tuples should be accepted:I'm also thinking that MultiIndex could accept dicts when initialising, and it would work similarly, except the dict keys would become the values for
MultiIndex.names
, and the dict values would be level values for the MultiIndex.The text was updated successfully, but these errors were encountered: