8000 ENH: Allow for join between two multi-index dataframe instances by harisbal · Pull Request #20356 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

ENH: Allow for join between two multi-index dataframe instances #20356

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

Merged
merged 25 commits into from
Nov 15, 2018
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b581789
Allow for join between two multi-index dataframe instances
Sep 19, 2018
2d61a12
Merge remote-tracking branch 'upstream/master' into multi-index-join
harisbal Sep 19, 2018
4d4acc5
Merge remote-tracking branch 'upstream/master' into multi-index-join
harisbal Oct 7, 2018
66d82fb
Review
harisbal Oct 8, 2018
c091bb4
Merge remote-tracking branch 'upstream/master' into multi-index-join
Oct 8, 2018
d56ebcd
Second review
harisbal Oct 9, 2018
0cdad73
Merge remote-tracking branch 'upstream/master' into multi-index-join
Oct 9, 2018
c2a65aa
Merge remote-tracking branch 'upstream/master' into multi-index-join
harisbal Oct 10, 2018
571fdf7
Merge remote-tracking branch 'upstream/master' into multi-index-join
Nov 1, 2018
ae2d8ad
Review
harisbal Nov 1, 2018
405c1a4
Merge remote-tracking branch 'upstream/master' into multi-index-join
harisbal Nov 1, 2018
1d2d9f3
Fix ci
harisbal Nov 3, 2018
f0ac24d
Merge branch 'master' into multi-index-join
Nov 3, 2018
5ac40ff
Merge remote-tracking branch 'upstream/master' into multi-index-join
harisbal Nov 3, 2018
be862c7
Update v0.24.0.txt
harisbal Nov 4, 2018
e10cbde
Update docstring _restore_dropped_levels_multijoin
harisbal Nov 4, 2018
06d48d0
Update docstring _restore_dropped_levels_multijoin
harisbal Nov 4, 2018
f54c151
Merge remote-tracking branch 'upstream/master' into multi-index-join
Nov 4, 2018
c75108d
Merge remote-tracking branch 'origin/multi-index-join' into multi-ind…
harisbal Nov 5, 2018
8000
c690260
Merge remote-tracking branch 'upstream/master' into multi-index-join
harisbal Nov 6, 2018
4092b34
updated comments
harisbal Nov 6, 2018
cfd5fcc
Refactoring
harisbal Nov 6, 2018
6c8131d
Review
harisbal Nov 10, 2018
ecaf515
Merge remote-tracking branch 'upstream/master' into multi-index-join
harisbal Nov 10, 2018
8b5d0aa
Merge remote-tracking branch 'upstream/master' into harisbal-multi-in…
TomAugspurger Nov 14, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Review
  • Loading branch information
harisbal authored and harisbal committed Nov 1, 2018
commit ae2d8ad6719833965a5286af05aae5b8a36eb488
17 changes: 9 additions & 8 deletions pandas/tests/reshape/merge/test_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def test_left_join_index_preserve_order(self):

tm.assert_frame_equal(result, expected)

def test_left_join_index_multi_match_multiindex(self):
def test_join_nonunique_multi_rindex(self):
left = DataFrame([
['X', 'Y', 'C', 'a'],
['W', 'Y', 'C', 'e'],
Expand All @@ -155,7 +155,7 @@ def test_left_join_index_multi_match_multiindex(self):
columns=['cola', 'colb', 'colc', 'tag'],
index=[3, 2, 0, 1, 7, 6, 4, 5, 9, 8])

right = DataFrame([
right = (DataFrame([
['W', 'R', 'C', 0],
['W', 'Q', 'B', 3],
['W', 'Q', 'B', 8],
Expand All @@ -171,7 +171,7 @@ def test_left_join_index_multi_match_multiindex(self):
['V', 'R', 'D', -1],
['V', 'Q', 'A', -3]],
columns=['col1', 'col2', 'col3', 'val'])
right.set_index(['col1', 'col2', 'col3'], inplace=True)
.set_index(['col1', 'col2', 'col3']))

result = left.join(right, on=['cola', 'colb', 'colc'], how='left')

Expand Down Expand Up @@ -203,7 +203,7 @@ def test_left_join_index_multi_match_multiindex(self):

tm.assert_frame_equal(result, expected)

def test_left_join_index_multi_match(self):
def test_join_nonunique_rindex(self):
left = DataFrame([
['c', 0],
['b', 1],
Expand All @@ -212,7 +212,7 @@ def test_left_join_index_multi_match(self):
columns=['tag', 'val'],
index=[2, 0, 1, 3])

right = DataFrame([
right = (DataFrame([
['a', 'v'],
['c', 'w'],
['c', 'x'],
Expand All @@ -222,8 +222,8 @@ def test_left_join_index_multi_match(self):
['e', 'q'],
['c', 's']],
columns=['tag', 'char'])
.set_index('tag'))

right.set_index('tag', inplace=True)
result = left.join(right, on='tag', how='left')

expected = DataFrame([
Expand All @@ -241,8 +241,9 @@ def test_left_join_index_multi_match(self):
tm.assert_frame_equal(result, expected)

result = left.join(right, on='tag', how='left', sort=True)
tm.assert_frame_equal(
result, expected.sort_values('tag', kind='mergesort'))
expected = expected.sort_values('tag', kind='mergesort')

tm.assert_frame_equal(result, expected)

# GH7331 - maintain left frame order in left merge
result = merge(left, right.reset_index(), how='left', on='tag')
Expand Down
0