3
3
"""
4
4
import operator
5
5
import re
6
- from typing import Optional , Pattern , Union
6
+ from typing import Pattern , Union
7
7
8
8
import numpy as np
9
9
14
14
is_numeric_v_string_like ,
15
15
is_scalar ,
16
16
)
17
- from pandas .core .dtypes .missing import isna
18
17
19
18
20
19
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 ,
25
21
) -> Union [ArrayLike , bool ]:
26
22
"""
27
23
Compare two array_like inputs of the same shape or two scalar values
@@ -33,8 +29,8 @@ def compare_or_regex_search(
33
29
----------
34
30
a : array_like
35
31
b : scalar or regex pattern
36
- regex : bool, default False
37
- mask : array_like or None (default)
32
+ regex : bool
33
+ mask : array_like
38
34
39
35
Returns
40
36
-------
@@ -68,8 +64,6 @@ def _check_comparison_types(
68
64
)
69
65
70
66
# 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 )
73
67
if isinstance (a , np .ndarray ):
74
68
a = a [mask ]
75
69
0 commit comments