Skip to content

Commit

Permalink
CLN: Masking array for nan check, changing array dtype (pandas-dev#35498
Browse files Browse the repository at this point in the history
)
  • Loading branch information
alexhlim committed Aug 10, 2020
1 parent 2bea731 commit e083962
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pandas/_libs/index.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@ cdef class IndexEngine:
Py_ssize_t i, j, n, n_t, n_alloc

self._ensure_mapping_populated()
if isnaobj(targets).any():
if targets[isnaobj(targets)].size > 0:
new_targets = [0 if checknull(t) else t for t in targets]
new_values = [0 if checknull(v) else v for v in self._get_index_values()]
targets = np.array(new_targets, dtype=object)
values = np.array(new_values, dtype=object)
targets = np.array(new_targets, dtype=targets.dtype)
values = np.array(new_values, dtype=self._get_index_values().dtype)
else:
values = np.array(self._get_index_values(), copy=False)

Expand Down

0 comments on commit e083962

Please sign in to comment.