>> ser.str.slice(None, ...">

API/BUG: obj.str.slice(start:None:-1) · Issue #59710 · pandas-dev/pandas (original) (raw)

import pandas as pd import pyarrow as pa

ser = pd.Series(["aafootwo", "aabartwo", pd.NA, "aabazqux"], dtype="string[pyarrow]") ser2 = ser.astype(pd.ArrowDtype(pa.string()))

ser.str.slice(None, None, -1) 0 owtoofaa 1 owtrabaa 2 3 xuqzabaa dtype: string

ser2.str.slice(None, None, -1) 0 a 1 a 2 3 a dtype: string[pyarrow]

This looks to me like the ArrowEA version is wrong, can @mroeschke or @jorisvandenbossche confirm this is not intentional?

The ArrowEA version's only test is in test_str_slice in tests/extension/test_arrow.py, has no test cases with either stop=None or step<0. The StringDtype version has a test_slice in tests/strings/test_strings.py that has a bit better coverage.