Skip to content

Commit f002d60

Browse files
committed
Removing comment, moving test_get_indexer_non_unique_multiple_nans (pandas-dev#35498)
1 parent 453320b commit f002d60

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

pandas/_libs/index.pyx

-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ cdef class IndexEngine:
270270
Py_ssize_t i, j, n, n_t, n_alloc
271271

272272
self._ensure_mapping_populated()
273-
# GH #35392 Index.get_indexer_non_unique misbehaves when index contains multiple nan
274273
if any([checknull(t) for t in targets]):
275274
new_targets = [0 if checknull(t) else t for t in targets]
276275
new_values = [0 if checknull(v) else v for v in self._get_index_values()]

pandas/tests/base/test_misc.py

-19
Original file line numberDiff line numberDiff line change
@@ -201,22 +201,3 @@ def test_get_indexer_non_unique_dtype_mismatch():
201201
indexes, missing = pd.Index(["A", "B"]).get_indexer_non_unique(pd.Index([0]))
202202
tm.assert_numpy_array_equal(np.array([-1], dtype=np.intp), indexes)
203203
tm.assert_numpy_array_equal(np.array([0], dtype=np.int64), missing)
204-
205-
206-
@pytest.mark.parametrize(
207-
"idx, target, expected",
208-
[
209-
([np.nan, "var1", np.nan], [np.nan], np.array([0, 2], dtype=np.int64)),
210-
(
211-
[np.nan, "var1", np.nan],
212-
[np.nan, "var1"],
213-
np.array([0, 2, 1], dtype=np.int64),
214-
),
215-
],
216-
)
217-
def test_get_indexer_non_unique_multiple_nans(idx, target, expected):
218-
# GH 35392
219-
axis = pd.Index(idx)
220-
actual = axis.get_indexer_for(target)
221-
222-
tm.assert_numpy_array_equal(actual, expected)

pandas/tests/indexes/test_base.py

+19
Original file line numberDiff line numberDiff line change
@@ -2614,3 +2614,22 @@ def construct(dtype):
26142614
no_matches = np.array([-1] * 6, dtype=np.intp)
26152615
tm.assert_numpy_array_equal(result[0], no_matches)
26162616
tm.assert_numpy_array_equal(result[1], no_matches)
2617+
2618+
2619+
@pytest.mark.parametrize(
2620+
"idx, target, expected",
2621+
[
2622+
([np.nan, "var1", np.nan], [np.nan], np.array([0, 2], dtype=np.int64)),
2623+
(
2624+
[np.nan, "var1", np.nan],
2625+
[np.nan, "var1"],
2626+
np.array([0, 2, 1], dtype=np.int64),
2627+
),
2628+
],
2629+
)
2630+
def test_get_indexer_non_unique_multiple_nans(idx, target, expected):
2631+
# GH 35392
2632+
axis = pd.Index(idx)
2633+
actual = axis.get_indexer_for(target)
2634+
2635+
tm.assert_numpy_array_equal(actual, expected)

0 commit comments

Comments
 (0)