@@ -460,7 +460,10 @@ def str_match(arr, pat, case=True, flags=0, na=np.nan, as_indexer=None):
460
460
461
461
regex = re .compile (pat , flags = flags )
462
462
463
- if as_indexer is not None :
463
+ if (as_indexer is False ) and (regex .groups > 0 ):
464
+ raise ValueError ("as_indexer=False with a pattern with groups is "
465
+ "no longer supported. Use .str.extract(pat) instead" )
466
+ elif as_indexer is not None :
464
467
# Previously, this keyword was used for changing the default but
465
468
# deprecated behaviour. This keyword is now no longer needed.
466
469
warnings .warn ("'as_indexer' keyword was specified but will be ignored;"
@@ -1523,7 +1526,7 @@ def contains(self, pat, case=True, flags=0, na=np.nan, regex=True):
1523
1526
return self ._wrap_result (result )
1524
1527
1525
1528
@copy (str_match )
1526
- def match (self , pat , case = True , flags = 0 , na = np .nan , as_indexer = False ):
1529
+ def match (self , pat , case = True , flags = 0 , na = np .nan , as_indexer = None ):
1527
1530
result = str_match (self ._data , pat , case = case , flags = flags , na = na ,
1528
1531
as_indexer = as_indexer )
1529
1532
return self ._wrap_result (result )
0 commit comments