@@ -574,29 +574,29 @@ def test_reindexing(self):
574
574
tm .assert_numpy_array_equal (expected , actual )
575
575
576
576
def test_reindex_dtype (self ):
577
- c = CategoricalIndex (["a" , "b" , "c" ])
577
+ c = CategoricalIndex (["a" , "b" , "c" , "a" ])
578
578
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 ))
581
581
582
- c = CategoricalIndex (["a" , "b" , "c" ])
582
+ c = CategoricalIndex (["a" , "b" , "c" , "a" ])
583
583
res , indexer = c .reindex (Categorical (["a" , "c" ]))
584
584
585
- exp = CategoricalIndex (["a" , "c" ], categories = ["a" , "c" ])
585
+ exp = CategoricalIndex (["a" , "a" , " c" ], categories = ["a" , "c" ])
586
586
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 ))
588
588
589
- c = CategoricalIndex (["a" , "b" , "c" ], categories = ["a" , "b" , "c" , "d" ])
589
+ c = CategoricalIndex (["a" , "b" , "c" , "a" ], categories = ["a" , "b" , "c" , "d" ])
590
590
res , indexer = c .reindex (["a" , "c" ])
591
- exp = Index (["a" , "c" ], dtype = "object" )
591
+ exp = Index (["a" , "a" , " c" ], dtype = "object" )
592
592
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 ))
594
594
595
- c = CategoricalIndex (["a" , "b" , "c" ], categories = ["a" , "b" , "c" , "d" ])
595
+ c = CategoricalIndex (["a" , "b" , "c" , "a" ], categories = ["a" , "b" , "c" , "d" ])
596
596
res , indexer = c .reindex (Categorical (["a" , "c" ]))
597
- exp = CategoricalIndex (["a" , "c" ], categories = ["a" , "c" ])
597
+ exp = CategoricalIndex (["a" , "a" , " c" ], categories = ["a" , "c" ])
598
598
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 ))
600
600
601
601
def test_reindex_duplicate_source (self ):
602
602
# See GH23963
0 commit comments