Skip to content

Commit 862a871

Browse files
Backport PR #42714: PERF/REGR: isin slowdown for masked type (#42726)
Co-authored-by: Matthew Zeitlin <[email protected]>
1 parent 2e5c54c commit 862a871

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

doc/source/whatsnew/v1.3.2.rst

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ including other versions of pandas.
1414

1515
Fixed regressions
1616
~~~~~~~~~~~~~~~~~
17+
- Performance regression in :meth:`DataFrame.isin` and :meth:`Series.isin` for nullable data types (:issue:`42714`)
1718
-
1819
-
1920

pandas/core/arrays/masked.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ def isin(self, values) -> BooleanArray: # type: ignore[override]
417417
# see https://github.com/pandas-dev/pandas/pull/38379 for some discussion
418418
result[self._mask] = values_have_NA
419419

420-
mask = np.zeros_like(self, dtype=bool)
420+
mask = np.zeros(self._data.shape, dtype=bool)
421421
return BooleanArray(result, mask, copy=False)
422422

423423
def copy(self: BaseMaskedArrayT) -> BaseMaskedArrayT:

0 commit comments

Comments
 (0)