Skip to content

Commit ae2d8ad

Browse files
harisbalharisbal
authored andcommitted
Review
1 parent 571fdf7 commit ae2d8ad

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

pandas/tests/reshape/merge/test_multi.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def test_left_join_index_preserve_order(self):
140140

141141
tm.assert_frame_equal(result, expected)
142142

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

158-
right = DataFrame([
158+
right = (DataFrame([
159159
['W', 'R', 'C', 0],
160160
['W', 'Q', 'B', 3],
161161
['W', 'Q', 'B', 8],
@@ -171,7 +171,7 @@ def test_left_join_index_multi_match_multiindex(self):
171171
['V', 'R', 'D', -1],
172172
['V', 'Q', 'A', -3]],
173173
columns=['col1', 'col2', 'col3', 'val'])
174-
right.set_index(['col1', 'col2', 'col3'], inplace=True)
174+
.set_index(['col1', 'col2', 'col3']))
175175

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

@@ -203,7 +203,7 @@ def test_left_join_index_multi_match_multiindex(self):
203203

204204
tm.assert_frame_equal(result, expected)
205205

206-
def test_left_join_index_multi_match(self):
206+
def test_join_nonunique_rindex(self):
207207
left = DataFrame([
208208
['c', 0],
209209
['b', 1],
@@ -212,7 +212,7 @@ def test_left_join_index_multi_match(self):
212212
columns=['tag', 'val'],
213213
index=[2, 0, 1, 3])
214214

215-
right = DataFrame([
215+
right = (DataFrame([
216216
['a', 'v'],
217217
['c', 'w'],
218218
['c', 'x'],
@@ -222,8 +222,8 @@ def test_left_join_index_multi_match(self):
222222
['e', 'q'],
223223
['c', 's']],
224224
columns=['tag', 'char'])
225+
.set_index('tag'))
225226

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

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

243243
result = left.join(right, on='tag', how='left', sort=True)
244-
tm.assert_frame_equal(
245-
result, expected.sort_values('tag', kind='mergesort'))
244+
expected = expected.sort_values('tag', kind='mergesort')
245+
246+
tm.assert_frame_equal(result, expected)
246247

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

0 commit comments

Comments
 (0)