Skip to content
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

BUG: allow None as name in multi-index during join #59546

Merged
merged 7 commits into from
Aug 26, 2024

Conversation

matiaslindgren
Copy link
Contributor

@matiaslindgren matiaslindgren commented Aug 18, 2024

Another possible fix is to throw if MultiIndex.names contains None.
The exception message could say something like "empty index names must be empty strings, not None".

@matiaslindgren matiaslindgren changed the title BUG: allow None as name in multi-index BUG: allow None as name in multi-index during join Aug 18, 2024
Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good to me, but we were explicit about not allowing None in the past and I'm not sure why. Traced it back to:

Don't see any discussion about None. Can you take a look @mroeschke

@@ -28,6 +28,7 @@ enhancement2

Other enhancements
^^^^^^^^^^^^^^^^^^
- :attr:`MultiIndex.names` containing ``None`` no longer throws ``AssertionError`` during join (:issue:`58721`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move the note to the Reshaping section of bugfixes.

@matiaslindgren
Copy link
Contributor Author

Automatic codeowner review requests were unintended, sorry. I accidentally pushed commits from my fork to this branch and that touched files unrelated to this PR. Force-pushed them away.

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mroeschke
Copy link
Member

pre-commit.ci autofix

@mroeschke mroeschke added this to the 3.0 milestone Aug 26, 2024
@mroeschke mroeschke merged commit 8f7080b into pandas-dev:main Aug 26, 2024
47 checks passed
@mroeschke
Copy link
Member

Thanks @matiaslindgren

@matiaslindgren matiaslindgren deleted the fix-58721 branch August 27, 2024 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug MultiIndex Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: joining dataframes with multi-index and None index label results in AssertionError
3 participants