Skip to content

Commit 42289d0

Browse files
authored
CLN: unused case in compare_or_regex_search (#36143)
1 parent 6e28008 commit 42289d0

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

pandas/core/array_algos/replace.py

+4-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
import operator
55
import re
6-
from typing import Optional, Pattern, Union
6+
from typing import Pattern, Union
77

88
import numpy as np
99

@@ -14,14 +14,10 @@
1414
is_numeric_v_string_like,
1515
is_scalar,
1616
)
17-
from pandas.core.dtypes.missing import isna
1817

1918

2019
def compare_or_regex_search(
21-
a: ArrayLike,
22-
b: Union[Scalar, Pattern],
23-
regex: bool = False,
24-
mask: Optional[ArrayLike] = None,
20+
a: ArrayLike, b: Union[Scalar, Pattern], regex: bool, mask: ArrayLike,
2521
) -> Union[ArrayLike, bool]:
2622
"""
2723
Compare two array_like inputs of the same shape or two scalar values
@@ -33,8 +29,8 @@ def compare_or_regex_search(
3329
----------
3430
a : array_like
3531
b : scalar or regex pattern
36-
regex : bool, default False
37-
mask : array_like or None (default)
32+
regex : bool
33+
mask : array_like
3834
3935
Returns
4036
-------
@@ -68,8 +64,6 @@ def _check_comparison_types(
6864
)
6965

7066
# GH#32621 use mask to avoid comparing to NAs
71-
if mask is None and isinstance(a, np.ndarray) and not isinstance(b, np.ndarray):
72-
mask = np.reshape(~(isna(a)), a.shape)
7367
if isinstance(a, np.ndarray):
7468
a = a[mask]
7569

0 commit comments

Comments
 (0)