-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
CLN: MultiIndex.union align with Index.union() #38423
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
Conversation
@@ -460,3 +460,12 @@ def test_intersection_different_names(): | |||
mi2 = MultiIndex.from_arrays([[1], [3]]) | |||
result = mi.intersection(mi2) | |||
tm.assert_index_equal(result, mi2) | |||
|
|||
|
|||
def test_union_empty_self_different_names(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason not to put this with the other union tests above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intersection test above is testing the Same for intersection. But we could move the union Test of course
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id prefer that, but not a big deal.
dont forget to fill in the GH ref
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't have a strong preference either. Moved it up a bit.
Added the gh ref
Can Index.union be updated to use the same code pattern? |
We could rewrite Edit: That is probably not that good of an idea. We are missing something like |
this looks like a bug fix no? e.g. let's add a whatsnew and merge (1.3) |
Only technically a bug, got in a few day ago only on master. technically because this function was only used for intersection before, which could not reach this case. So I think no need for whatsnew? |
thanks |
* CLN: MultiIndex.union to look like Index.union() * Fix failing tests * Move test
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
Similar to MultiIndex.intersection()
Stumbled over a issue in the maybe_match_names function. Can not return plain None, because MultiIndex.rename can not handle this.
cc @jbrockmendel