Skip to content

Commit ee6561b

Browse files
committed
API: fall back to object dtype
1 parent 767857e commit ee6561b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pandas/core/arrays/_arrow_string_mixins.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ def _str_pad(
4040
elif side == "both":
4141
if pa_version_under17p0:
4242
# GH#59624 fall back to object dtype
43-
return super()._str_pad(width, side, fillchar)
43+
from pandas import array
44+
45+
obj_arr = self.astype(object, copy=False) # type: ignore[attr-defined]
46+
obj = array(obj_arr, dtype=object)
47+
result = obj._str_pad(width, side, fillchar) # type: ignore[attr-defined]
48+
return type(self)._from_sequence(result, dtype=self.dtype) # type: ignore[attr-defined]
4449
else:
4550
# GH#54792
4651
pa_pad = partial(pc.utf8_center, lean_left_on_odd_padding=False)

0 commit comments

Comments
 (0)