@@ -364,11 +364,11 @@ def str_match(arr, pat, case=True, flags=0, na=np.nan, as_indexer=False):
364
364
# Do this first, to make sure it happens even if the re.compile
365
365
# raises below.
366
366
warnings .warn ("In future versions of pandas, match will change to"
367
- " always return a bool indexer." "" , UserWarning )
367
+ " always return a bool indexer." , UserWarning )
368
368
369
369
if as_indexer and regex .groups > 0 :
370
370
warnings .warn ("This pattern has match groups. To actually get the"
371
- " groups, use str.extract." "" , UserWarning )
371
+ " groups, use str.extract." , UserWarning )
372
372
373
373
# If not as_indexer and regex.groups == 0, this returns empty lists
374
374
# and is basically useless, so we will not warn.
@@ -384,7 +384,7 @@ def f(x):
384
384
# This is the new behavior of str_match.
385
385
f = lambda x : bool (regex .match (x ))
386
386
387
- return _na_map (f , arr )
387
+ return _na_map (f , arr , na )
388
388
389
389
390
390
def str_extract (arr , pat , flags = 0 ):
@@ -887,6 +887,12 @@ def contains(self, pat, case=True, flags=0, na=np.nan, regex=True):
887
887
na = na , regex = regex )
888
888
return self ._wrap_result (result )
889
889
890
+ @copy (str_match )
891
+ def match (self , pat , case = True , flags = 0 , na = np .nan , as_indexer = False ):
892
+ result = str_match (self .series , pat , case = case , flags = flags ,
893
+ na = na , as_indexer = as_indexer )
894
+ return self ._wrap_result (result )
895
+
890
896
@copy (str_replace )
891
897
def replace (self , pat , repl , n = - 1 , case = True , flags = 0 ):
892
898
result = str_replace (self .series , pat , repl , n = n , case = case ,
@@ -951,7 +957,6 @@ def get_dummies(self, sep='|'):
951
957
startswith = _pat_wrapper (str_startswith , na = True )
952
958
endswith = _pat_wrapper (str_endswith , na = True )
953
959
findall = _pat_wrapper (str_findall , flags = True )
954
- match = _pat_wrapper (str_match , flags = True )
955
960
extract = _pat_wrapper (str_extract , flags = True )
956
961
957
962
len = _noarg_wrapper (str_len )
0 commit comments