@@ -37,6 +37,32 @@ def test_get_indexer_non_unique_dtype_mismatch(self):
37
37
tm .assert_numpy_array_equal (np .array ([- 1 ], dtype = np .intp ), indexes )
38
38
tm .assert_numpy_array_equal (np .array ([0 ], dtype = np .intp ), missing )
39
39
40
+ def test_get_indexer_non_unique_int_index (self ):
41
+ indexes , missing = Index ([np .nan , 100 , 200 , 100 ]).get_indexer_non_unique (
42
+ Index ([np .nan ])
43
+ )
44
+ tm .assert_numpy_array_equal (np .array ([0 ], dtype = np .intp ), indexes )
45
+ tm .assert_numpy_array_equal (np .array ([], dtype = np .intp ), missing )
46
+
47
+ indexes , missing = Index ([np .nan , 100 , 200 , 100 ]).get_indexer_non_unique (
48
+ Index ([np .nan , 100 ])
49
+ )
50
+ tm .assert_numpy_array_equal (np .array ([0 , 1 , 3 ], dtype = np .intp ), indexes )
51
+ tm .assert_numpy_array_equal (np .array ([], dtype = np .intp ), missing )
52
+
53
+ def test_get_indexer_non_unique_float_index (self ):
54
+ indexes , missing = Index ([np .nan , 100.0 , 200.0 , 100.0 ]).get_indexer_non_unique (
55
+ Index ([np .nan ])
56
+ )
57
+ tm .assert_numpy_array_equal (np .array ([0 ], dtype = np .intp ), indexes )
58
+ tm .assert_numpy_array_equal (np .array ([], dtype = np .intp ), missing )
59
+
60
+ indexes , missing = Index ([np .nan , 100.0 , 200.0 , 100.0 ]).get_indexer_non_unique (
61
+ Index ([np .nan , 100.0 ])
62
+ )
63
+ tm .assert_numpy_array_equal (np .array ([0 , 1 , 3 ], dtype = np .intp ), indexes )
64
+ tm .assert_numpy_array_equal (np .array ([], dtype = np .intp ), missing )
65
+
40
66
41
67
class TestGetLoc :
42
68
@pytest .mark .slow # to_flat_index takes a while
0 commit comments