From 3b24db74ca098e50e58493deac49cf1032d45f24 Mon Sep 17 00:00:00 2001 From: Brock Date: Fri, 6 Sep 2024 09:05:27 -0700 Subject: [PATCH] set start=-1 --- pandas/core/arrays/arrow/array.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pandas/core/arrays/arrow/array.py b/pandas/core/arrays/arrow/array.py index 36be35596ff8d4..526342e084f709 100644 --- a/pandas/core/arrays/arrow/array.py +++ b/pandas/core/arrays/arrow/array.py @@ -2396,12 +2396,12 @@ def _str_rpartition(self, sep: str, expand: bool) -> Self: def _str_slice( self, start: int | None = None, stop: int | None = None, step: int | None = None ) -> Self: - if step is not None and step < 0: - # GH#59710 - result = self._apply_elementwise(lambda x: x[start:stop:step]) - return type(self)(pa.chunked_array(result)) if start is None: - start = 0 + if step is not None and step < 0: + # GH#59710 + start = -1 + else: + start = 0 if step is None: step = 1 return type(self)(