Skip to content

Commit c30bd01

Browse files
author
Vítor Araujo
committed
BUG: Replace method raising error in col with pd.NA (#47480)
1 parent 5094008 commit c30bd01

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pandas/core/missing.py

+5
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ def mask_missing(arr: ArrayLike, values_to_mask) -> npt.NDArray[np.bool_]:
9494
pass
9595
else:
9696
new_mask = arr == x
97+
# GH#47480
98+
if isinstance(new_mask, bool):
99+
new_mask = np.equal(arr, x, dtype=object)
100+
mask_na = np.vectorize(lambda value: False if isna(value) else value)
101+
new_mask = mask_na(new_mask).astype(bool)
97102
if not isinstance(new_mask, np.ndarray):
98103
# usually BooleanArray
99104
new_mask = new_mask.to_numpy(dtype=bool, na_value=False)

0 commit comments

Comments
 (0)