Skip to content

Commit f9b4c37

Browse files
Restore original CategoricalIndex.reindex test
1 parent 39773bc commit f9b4c37

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

pandas/tests/indexes/test_category.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -574,29 +574,29 @@ def test_reindexing(self):
574574
tm.assert_numpy_array_equal(expected, actual)
575575

576576
def test_reindex_dtype(self):
577-
c = CategoricalIndex(["a", "b", "c"])
577+
c = CategoricalIndex(["a", "b", "c", "a"])
578578
res, indexer = c.reindex(["a", "c"])
579-
tm.assert_index_equal(res, Index(["a", "c"]), exact=True)
580-
tm.assert_numpy_array_equal(indexer, np.array([0, 2], dtype=np.intp))
579+
tm.assert_index_equal(res, Index(["a", "a", "c"]), exact=True)
580+
tm.assert_numpy_array_equal(indexer, np.array([0, 3, 2], dtype=np.intp))
581581

582-
c = CategoricalIndex(["a", "b", "c"])
582+
c = CategoricalIndex(["a", "b", "c", "a"])
583583
res, indexer = c.reindex(Categorical(["a", "c"]))
584584

585-
exp = CategoricalIndex(["a", "c"], categories=["a", "c"])
585+
exp = CategoricalIndex(["a", "a", "c"], categories=["a", "c"])
586586
tm.assert_index_equal(res, exp, exact=True)
587-
tm.assert_numpy_array_equal(indexer, np.array([0, 2], dtype=np.intp))
587+
tm.assert_numpy_array_equal(indexer, np.array([0, 3, 2], dtype=np.intp))
588588

589-
c = CategoricalIndex(["a", "b", "c"], categories=["a", "b", "c", "d"])
589+
c = CategoricalIndex(["a", "b", "c", "a"], categories=["a", "b", "c", "d"])
590590
res, indexer = c.reindex(["a", "c"])
591-
exp = Index(["a", "c"], dtype="object")
591+
exp = Index(["a", "a", "c"], dtype="object")
592592
tm.assert_index_equal(res, exp, exact=True)
593-
tm.assert_numpy_array_equal(indexer, np.array([0, 2], dtype=np.intp))
593+
tm.assert_numpy_array_equal(indexer, np.array([0, 3, 2], dtype=np.intp))
594594

595-
c = CategoricalIndex(["a", "b", "c"], categories=["a", "b", "c", "d"])
595+
c = CategoricalIndex(["a", "b", "c", "a"], categories=["a", "b", "c", "d"])
596596
res, indexer = c.reindex(Categorical(["a", "c"]))
597-
exp = CategoricalIndex(["a", "c"], categories=["a", "c"])
597+
exp = CategoricalIndex(["a", "a", "c"], categories=["a", "c"])
598598
tm.assert_index_equal(res, exp, exact=True)
599-
tm.assert_numpy_array_equal(indexer, np.array([0, 2], dtype=np.intp))
599+
tm.assert_numpy_array_equal(indexer, np.array([0, 3, 2], dtype=np.intp))
600600

601601
def test_reindex_duplicate_source(self):
602602
# See GH23963

0 commit comments

Comments
 (0)