@@ -364,11 +364,11 @@ def str_match(arr, pat, case=True, flags=0, na=np.nan, as_indexer=False):
364364 # Do this first, to make sure it happens even if the re.compile
365365 # raises below.
366366 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 )
368368
369369 if as_indexer and regex .groups > 0 :
370370 warnings .warn ("This pattern has match groups. To actually get the"
371- " groups, use str.extract." "" , UserWarning )
371+ " groups, use str.extract." , UserWarning )
372372
373373 # If not as_indexer and regex.groups == 0, this returns empty lists
374374 # and is basically useless, so we will not warn.
@@ -384,7 +384,7 @@ def f(x):
384384 # This is the new behavior of str_match.
385385 f = lambda x : bool (regex .match (x ))
386386
387- return _na_map (f , arr )
387+ return _na_map (f , arr , na )
388388
389389
390390def str_extract (arr , pat , flags = 0 ):
@@ -887,6 +887,12 @@ def contains(self, pat, case=True, flags=0, na=np.nan, regex=True):
887887 na = na , regex = regex )
888888 return self ._wrap_result (result )
889889
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+
890896 @copy (str_replace )
891897 def replace (self , pat , repl , n = - 1 , case = True , flags = 0 ):
892898 result = str_replace (self .series , pat , repl , n = n , case = case ,
@@ -951,7 +957,6 @@ def get_dummies(self, sep='|'):
951957 startswith = _pat_wrapper (str_startswith , na = True )
952958 endswith = _pat_wrapper (str_endswith , na = True )
953959 findall = _pat_wrapper (str_findall , flags = True )
954- match = _pat_wrapper (str_match , flags = True )
955960 extract = _pat_wrapper (str_extract , flags = True )
956961
957962 len = _noarg_wrapper (str_len )
0 commit comments