Skip to content

Commit 2899bca

Browse files
authored
typing and remove code backtick possibly incorrectly triggering ruff formatter
1 parent 8c596ea commit 2899bca

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pandas/core/missing.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,11 @@ def mask_missing(arr: ArrayLike, values_to_mask) -> npt.NDArray[np.bool_]:
125125
new_mask[arr_mask] = arr[arr_mask] == x
126126
else:
127127
# GH#47101
128-
# Fix where type 'bool' has no attribute 'to_numpy()' by first
128+
# Fix where type bool has no attribute to_numpy() by first
129129
# attempting to broadcast with np.equal for some cases, and then
130130
# an explicit type check when checking the mask for any straggling
131-
# cases
131+
# cases. Where a literal comparison would fail np.equal we fall back
132+
# to the original equality check.
132133
try:
133134
new_mask = np.equal(arr, x)
134135
except TypeError:
@@ -138,7 +139,7 @@ def mask_missing(arr: ArrayLike, values_to_mask) -> npt.NDArray[np.bool_]:
138139
if not isinstance(new_mask, np.ndarray):
139140
# usually BooleanArray
140141
if isinstance(new_mask, bool):
141-
new_mask = np.array([new_mask])
142+
new_mask = np.array([new_mask], dtype= bool)
142143
else:
143144
new_mask = new_mask.to_numpy(dtype=bool, na_value=False)
144145
mask |= new_mask

0 commit comments

Comments
 (0)