-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Index.map fails when index has a name and mapping returns tuple #20990
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
Labels
Milestone
Comments
In fact, perhaps a better solution would be to add a |
I was playing around with this and discovered that
works. In particular,
returns
|
This looks to be working; could use a test:
|
Can I work on this? I'm first time contributor and would like to get into the project. |
Go for it @Reksbril! |
Reksbril
pushed a commit
to Reksbril/pandas
that referenced
this issue
Oct 19, 2019
4 tasks
Reksbril
pushed a commit
to Reksbril/pandas
that referenced
this issue
Nov 18, 2019
Reksbril
pushed a commit
to Reksbril/pandas
that referenced
this issue
Nov 18, 2019
WillAyd
pushed a commit
that referenced
this issue
Nov 18, 2019
proost
pushed a commit
to proost/pandas
that referenced
this issue
Dec 19, 2019
proost
pushed a commit
to proost/pandas
that referenced
this issue
Dec 19, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is related to #18696.
Code Sample
Problem description
The above code fails with
ValueError: Names should be list-like for a MultiIndex
.I understand that a scalar name can't meaningfully be carried over to a
MultiIndex
, but there's no documentation stating thatIndex.map
will fail under these conditions, and moreover there's no way to useIndex.map
here without eithername
toNone
, which is wasteful.I think a better solution would be to discard the name when returning a
MultiIndex
if the existingname
isn't compatible, and then to make this behaviour clear in the documentation.Expected Output
Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: