-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: left join on index with multiple matches now works (GH5391) #7853
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
pls add a release note in v0.15.0 bug fix section (ref the original issue) |
http://nbviewer.ipython.org/github/behzadnouri/infra/blob/master/python/GH5391.ipynb release note added. |
can you just copy paste these to the top of this pr, pls |
@jreback copy-pasted |
@behzadnouri what I mean is show the actual execution of the ipython, so its easy to see the results just a simple: left.... joined... |
don't you see the actual execution on the link i provided? |
@behzadnouri you are missing the point I don't want to actually pull in your PR to do this. I simply want to look at the PR and see what is happening. I am not making in unproductive, but PRODUCTIVE. you have to realize that 99% of people are not going to pull in this PR, but want to see what it does. |
and what is the problem with the nbviewer link i provided? |
because the problem is then when you search on github its hard to see what this issue is about. Why can't you simply update the top of the PR? its just a copy-paste. |
@@ -958,6 +958,68 @@ def test_left_join_index_preserve_order(self): | |||
right_on=['k1', 'k2'], how='right') | |||
tm.assert_frame_equal(joined.ix[:, expected.columns], expected) | |||
|
|||
def test_left_join_index_multi_match_multiindex(self): |
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.
does this work similarly on right / inner / outer when multiple matches? e.g. is left special case behavior, if so, why is that? if not, can you test with other how's. thanks.
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.
I have not tried right join;
As in your own comment in #5391 it works for outer join.
For left join, Wes adds this extra if not sort:
part to preserve order of left frame, which has this implicit assumption that there are no 1-to-many matches, and breaks if there are 1-to-many matches. see here
all the way up-to just before if not sort:
things work fine.
@jreback added the ipython notebook output |
@behzadnouri ok, thanks for the output ok, also need to investigate a join with multiple columns (that are non-unique). |
@jreback the test frame extended to include multiple columns with different values |
can you squash to a single commit. |
how should i do that? |
done. |
can you restart travis on this and see if it passes
and repush I get a failure when I tried in master |
all i can say this is passing travis build |
@jreback is this resolved on your end? |
merged via 4411ab6 The problem was that you made a change in thanks! |
closes #5391
This closes on: #5391
By providing all the matches when doing left join on index, both in the case of single index and multi-index. It also preserves the index order of the calling (left) DataFrame (as it used to), though when there are multiple matches the indices repeat and the index loses integrity.
The added test cases should be self-explanatory.
Thank you,