Skip to content

Commit e083962

Browse files
committed
CLN: Masking array for nan check, changing array dtype (pandas-dev#35498)
1 parent 2bea731 commit e083962

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/_libs/index.pyx

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

272272
self._ensure_mapping_populated()
273-
if isnaobj(targets).any():
273+
if targets[isnaobj(targets)].size > 0:
274274
new_targets = [0 if checknull(t) else t for t in targets]
275275
new_values = [0 if checknull(v) else v for v in self._get_index_values()]
276-
targets = np.array(new_targets, dtype=object)
277-
values = np.array(new_values, dtype=object)
276+
targets = np.array(new_targets, dtype=targets.dtype)
277+
values = np.array(new_values, dtype=self._get_index_values().dtype)
278278
else:
279279
values = np.array(self._get_index_values(), copy=False)
280280

0 commit comments

Comments
 (0)