@@ -337,20 +337,6 @@ def _str_repeat(self, repeats: int | Sequence[int]):
337
337
else :
338
338
return ArrowExtensionArray ._str_repeat (self , repeats = repeats )
339
339
340
- def _str_match (
341
- self , pat : str , case : bool = True , flags : int = 0 , na : Scalar | None = None
342
- ):
343
- if not pat .startswith ("^" ):
344
- pat = f"^{ pat } "
345
- return self ._str_contains (pat , case , flags , na , regex = True )
346
-
347
- def _str_fullmatch (
348
- self , pat , case : bool = True , flags : int = 0 , na : Scalar | None = None
349
- ):
350
- if not pat .endswith ("$" ) or pat .endswith ("\\ $" ):
351
- pat = f"{ pat } $"
352
- return self ._str_match (pat , case , flags , na )
353
-
354
340
def _str_slice (
355
341
self , start : int | None = None , stop : int | None = None , step : int | None = None
356
342
) -> Self :
@@ -362,23 +348,20 @@ def _str_len(self):
362
348
result = pc .utf8_length (self ._pa_array )
363
349
return self ._convert_int_result (result )
364
350
351
+ _str_match = ArrowExtensionArray ._str_match
352
+ _str_fullmatch = ArrowExtensionArray ._str_fullmatch
365
353
_str_lower = ArrowExtensionArray ._str_lower
366
354
_str_upper = ArrowExtensionArray ._str_upper
367
355
_str_strip = ArrowExtensionArray ._str_strip
368
356
_str_lstrip = ArrowExtensionArray ._str_lstrip
369
357
_str_rstrip = ArrowExtensionArray ._str_rstrip
358
+ _str_removesuffix = ArrowStringArrayMixin ._str_removesuffix
370
359
371
360
def _str_removeprefix (self , prefix : str ):
372
361
if not pa_version_under13p0 :
373
362
return ArrowExtensionArray ._str_removeprefix (self , prefix )
374
363
return super ()._str_removeprefix (prefix )
375
364
376
- def _str_removesuffix (self , suffix : str ):
377
- ends_with = pc .ends_with (self ._pa_array , pattern = suffix )
378
- removed = pc .utf8_slice_codeunits (self ._pa_array , 0 , stop = - len (suffix ))
379
- result = pc .if_else (ends_with , removed , self ._pa_array )
380
- return type (self )(result )
381
-
382
365
def _str_count (self , pat : str , flags : int = 0 ):
383
366
if flags :
384
367
return super ()._str_count (pat , flags )
0 commit comments