Skip to content

Commit 584ba18

Browse files
committed
API: fall back to object dtype
1 parent 815579a commit 584ba18

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
@@ -55,7 +55,12 @@ def _str_pad(
5555
elif side == "both":
5656
if pa_version_under17p0:
5757
# GH#59624 fall back to object dtype
58-
return super()._str_pad(width, side, fillchar)
58+
from pandas import array
59+
60+
obj_arr = self.astype(object, copy=False) # type: ignore[attr-defined]
61+
obj = array(obj_arr, dtype=object)
62+
result = obj._str_pad(width, side, fillchar) # type: ignore[attr-defined]
63+
return type(self)._from_sequence(result, dtype=self.dtype) # type: ignore[attr-defined]
5964
else:
6065
# GH#54792
6166
pa_pad = partial(pc.utf8_center, lean_left_on_odd_padding=False)

0 commit comments

Comments
 (0)