Skip to content

Commit f251cfa

Browse files
committed
CLN: adding to set instead of copy (#35498)
1 parent a2729bf commit f251cfa

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

pandas/_libs/index.pyx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,9 @@ cdef class IndexEngine:
277277
values = np.array(self._get_index_values(), copy=False)
278278
values_mask = isnaobj(values)
279279
targets_mask = isnaobj(targets)
280+
stargets = set(targets)
280281
if targets_mask.any():
281-
targets_no_nan = targets.copy()
282-
targets_no_nan[targets_mask] = -1
283-
stargets = set(targets_no_nan)
284-
else:
285-
stargets = set(targets)
282+
stargets.add(-1)
286283
n = len(values)
287284
n_t = len(targets)
288285
if n > 10_000:

0 commit comments

Comments
 (0)