@@ -1225,7 +1225,12 @@ def join(self, sep: str):
1225
1225
1226
1226
@forbid_nonstring_types (["bytes" ])
1227
1227
def contains (
1228
- self , pat , case : bool = True , flags : int = 0 , na = None , regex : bool = True
1228
+ self ,
1229
+ pat ,
1230
+ case : bool = True ,
1231
+ flags : int = 0 ,
1232
+ na = lib .no_default ,
1233
+ regex : bool = True ,
1229
1234
):
1230
1235
r"""
1231
1236
Test if pattern or regex is contained within a string of a Series or Index.
@@ -1243,8 +1248,9 @@ def contains(
1243
1248
Flags to pass through to the re module, e.g. re.IGNORECASE.
1244
1249
na : scalar, optional
1245
1250
Fill value for missing values. The default depends on dtype of the
1246
- array. For object-dtype, ``numpy.nan`` is used. For ``StringDtype``,
1247
- ``pandas.NA`` is used.
1251
+ array. For object-dtype, ``numpy.nan`` is used. For the nullable
1252
+ ``StringDtype``, ``pandas.NA`` is used. For the ``"str"`` dtype,
1253
+ ``False`` is used.
1248
1254
regex : bool, default True
1249
1255
If True, assumes the pat is a regular expression.
1250
1256
@@ -1362,7 +1368,7 @@ def contains(
1362
1368
return self ._wrap_result (result , fill_value = na , returns_string = False )
1363
1369
1364
1370
@forbid_nonstring_types (["bytes" ])
1365
- def match (self , pat : str , case : bool = True , flags : int = 0 , na = None ):
1371
+ def match (self , pat : str , case : bool = True , flags : int = 0 , na = lib . no_default ):
1366
1372
"""
1367
1373
Determine if each string starts with a match of a regular expression.
1368
1374
@@ -1376,8 +1382,9 @@ def match(self, pat: str, case: bool = True, flags: int = 0, na=None):
1376
1382
Regex module flags, e.g. re.IGNORECASE.
1377
1383
na : scalar, optional
1378
1384
Fill value for missing values. The default depends on dtype of the
1379
- array. For object-dtype, ``numpy.nan`` is used. For ``StringDtype``,
1380
- ``pandas.NA`` is used.
1385
+ array. For object-dtype, ``numpy.nan`` is used. For the nullable
1386
+ ``StringDtype``, ``pandas.NA`` is used. For the ``"str"`` dtype,
1387
+ ``False`` is used.
1381
1388
1382
1389
Returns
1383
1390
-------
@@ -1406,7 +1413,7 @@ def match(self, pat: str, case: bool = True, flags: int = 0, na=None):
1406
1413
return self ._wrap_result (result , fill_value = na , returns_string = False )
1407
1414
1408
1415
@forbid_nonstring_types (["bytes" ])
1409
- def fullmatch (self , pat , case : bool = True , flags : int = 0 , na = None ):
1416
+ def fullmatch (self , pat , case : bool = True , flags : int = 0 , na = lib . no_default ):
1410
1417
"""
1411
1418
Determine if each string entirely matches a regular expression.
1412
1419
@@ -1420,8 +1427,9 @@ def fullmatch(self, pat, case: bool = True, flags: int = 0, na=None):
1420
1427
Regex module flags, e.g. re.IGNORECASE.
1421
1428
na : scalar, optional
1422
1429
Fill value for missing values. The default depends on dtype of the
1423
- array. For object-dtype, ``numpy.nan`` is used. For ``StringDtype``,
1424
- ``pandas.NA`` is used.
1430
+ array. For object-dtype, ``numpy.nan`` is used. For the nullable
1431
+ ``StringDtype``, ``pandas.NA`` is used. For the ``"str"`` dtype,
1432
+ ``False`` is used.
1425
1433
1426
1434
Returns
1427
1435
-------
@@ -2612,7 +2620,7 @@ def count(self, pat, flags: int = 0):
2612
2620
2613
2621
@forbid_nonstring_types (["bytes" ])
2614
2622
def startswith (
2615
- self , pat : str | tuple [str , ...], na : Scalar | None = None
2623
+ self , pat : str | tuple [str , ...], na : Scalar | lib . NoDefault = lib . no_default
2616
2624
) -> Series | Index :
2617
2625
"""
2618
2626
Test if the start of each string element matches a pattern.
@@ -2624,10 +2632,11 @@ def startswith(
2624
2632
pat : str or tuple[str, ...]
2625
2633
Character sequence or tuple of strings. Regular expressions are not
2626
2634
accepted.
2627
- na : object, default NaN
2635
+ na : scalar, optional
2628
2636
Object shown if element tested is not a string. The default depends
2629
2637
on dtype of the array. For object-dtype, ``numpy.nan`` is used.
2630
- For ``StringDtype``, ``pandas.NA`` is used.
2638
+ For the nullable ``StringDtype``, ``pandas.NA`` is used.
2639
+ For the ``"str"`` dtype, ``False`` is used.
2631
2640
2632
2641
Returns
2633
2642
-------
@@ -2682,7 +2691,7 @@ def startswith(
2682
2691
2683
2692
@forbid_nonstring_types (["bytes" ])
2684
2693
def endswith (
2685
- self , pat : str | tuple [str , ...], na : Scalar | None = None
2694
+ self , pat : str | tuple [str , ...], na : Scalar | lib . NoDefault = lib . no_default
2686
2695
) -> Series | Index :
2687
2696
"""
2688
2697
Test if the end of each string element matches a pattern.
@@ -2694,10 +2703,11 @@ def endswith(
2694
2703
pat : str or tuple[str, ...]
2695
2704
Character sequence or tuple of strings. Regular expressions are not
2696
2705
accepted.
2697
- na : object, default NaN
2706
+ na : scalar, optional
2698
2707
Object shown if element tested is not a string. The default depends
2699
2708
on dtype of the array. For object-dtype, ``numpy.nan`` is used.
2700
- For ``StringDtype``, ``pandas.NA`` is used.
2709
+ For the nullable ``StringDtype``, ``pandas.NA`` is used.
2710
+ For the ``"str"`` dtype, ``False`` is used.
2701
2711
2702
2712
Returns
2703
2713
-------
0 commit comments