@@ -360,20 +360,6 @@ def _str_repeat(self, repeats: int | Sequence[int]):
360
360
else :
361
361
return ArrowExtensionArray ._str_repeat (self , repeats = repeats )
362
362
363
- def _str_match (
364
- self , pat : str , case : bool = True , flags : int = 0 , na : Scalar | None = None
365
- ):
366
- if not pat .startswith ("^" ):
367
- pat = f"^{ pat } "
368
- return self ._str_contains (pat , case , flags , na , regex = True )
369
-
370
- def _str_fullmatch (
371
- self , pat , case : bool = True , flags : int = 0 , na : Scalar | None = None
372
- ):
373
- if not pat .endswith ("$" ) or pat .endswith ("\\ $" ):
374
- pat = f"{ pat } $"
375
- return self ._str_match (pat , case , flags , na )
376
-
377
363
def _str_slice (
378
364
self , start : int | None = None , stop : int | None = None , step : int | None = None
379
365
) -> Self :
@@ -421,23 +407,20 @@ def _str_len(self):
421
407
result = pc .utf8_length (self ._pa_array )
422
408
return self ._convert_int_dtype (result )
423
409
410
+ _str_match = ArrowExtensionArray ._str_match
411
+ _str_fullmatch = ArrowExtensionArray ._str_fullmatch
424
412
_str_lower = ArrowExtensionArray ._str_lower
425
413
_str_upper = ArrowExtensionArray ._str_upper
426
414
_str_strip = ArrowExtensionArray ._str_strip
427
415
_str_lstrip = ArrowExtensionArray ._str_lstrip
428
416
_str_rstrip = ArrowExtensionArray ._str_rstrip
417
+ _str_removesuffix = ArrowStringArrayMixin ._str_removesuffix
429
418
430
419
def _str_removeprefix (self , prefix : str ):
431
420
if not pa_version_under13p0 :
432
421
return ArrowExtensionArray ._str_removeprefix (self , prefix )
433
422
return super ()._str_removeprefix (prefix )
434
423
435
- def _str_removesuffix (self , suffix : str ):
436
- ends_with = pc .ends_with (self ._pa_array , pattern = suffix )
437
- removed = pc .utf8_slice_codeunits (self ._pa_array , 0 , stop = - len (suffix ))
438
- result = pc .if_else (ends_with , removed , self ._pa_array )
439
- return type (self )(result )
440
-
441
424
def _str_count (self , pat : str , flags : int = 0 ):
442
425
if flags :
443
426
return super ()._str_count (pat , flags )
0 commit comments