Skip to content

API/BUG: obj.str.slice(start:None:-1) #59710

Closed
@jbrockmendel

Description

@jbrockmendel
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        <NA>
3    xuqzabaa
dtype: string

>>> ser2.str.slice(None, None, -1)
0       a
1       a
2    <NA>
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Arrowpyarrow functionalityBugStringsString extension data type and string data

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions