Skip to content

Commit 16c3103

Browse files
committed
Removed explicit test for array of inverse; tested implicitly
1 parent 5c35c8d commit 16c3103

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

pandas/tests/indexes/common.py

-14
Original file line numberDiff line numberDiff line change
@@ -402,23 +402,9 @@ def test_duplicated_inverse(self, indices, keep):
402402
idx = self._holder(idx.values[duplicated_selection])
403403

404404
expected_isdup = idx.duplicated(keep=keep)
405-
if keep == 'first':
406-
_, tmp_ind, tmp_inv = np.unique(idx, return_index=True,
407-
return_inverse=True)
408-
else: # 'last'
409-
# switch order before calling unique then restore correct ordering
410-
# for tmp_ind, tmp_inv
411-
_, tmp_ind, tmp_inv = np.unique(idx[::-1], return_index=True,
412-
return_inverse=True)
413-
tmp_ind = np.arange(len(idx))[::-1][tmp_ind]
414-
tmp_inv = tmp_inv[::-1]
415-
# explanation in pandas.core.algorithms.duplicated
416-
expected_inv = np.argsort(np.argsort(tmp_ind))[tmp_inv]
417-
418405
result_isdup, result_inv = idx.duplicated(keep=keep,
419406
return_inverse=True)
420407
tm.assert_numpy_array_equal(result_isdup, expected_isdup)
421-
tm.assert_numpy_array_equal(result_inv, expected_inv)
422408

423409
# test that result_inv works (and fits together with expected_isdup)
424410
unique = idx[~expected_isdup]

0 commit comments

Comments
 (0)