Skip to content

BUG (string): Series.str.slice with negative step #59724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Sep 10, 2024

Conversation

jbrockmendel
Copy link
Member

Comment on lines 2426 to 2427
if start is None:
start = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment in #59710, but so probably this should be start = -1 if step < 0, and then the above fallback might not be needed

@jorisvandenbossche
Copy link
Member

If something fails for older version of pyarrow, can we instead fallback to the python implementation for that version of pyarrow? (instead of failing for the user, i.e. skipping that in the tests)

@jorisvandenbossche jorisvandenbossche added the Strings String extension data type and string data label Sep 9, 2024
@jorisvandenbossche jorisvandenbossche added this to the 2.3 milestone Sep 9, 2024
@jorisvandenbossche
Copy link
Member

And while we are touching those methods, move it to the mixin at once as well?

@jbrockmendel
Copy link
Member Author

If something fails for older version of pyarrow, can we instead fallback to the python implementation for that version of pyarrow? (instead of failing for the user, i.e. skipping that in the tests)

just tried that and it broke the min versions test, looks like it is getting an int64 dtype somehow. just restored the xfail.

@jorisvandenbossche
Copy link
Member

Sorry, I don't understand how that can let those tests fail to use our long-used object dtype implementation. What was the error you got?
FWIW it would help in reviewing if you pushed additional commits instead of reverting/force pushing, then it is clearer what you actually tried and what the CI said

@jbrockmendel
Copy link
Member Author

Sorry, I don't understand how that can let those tests fail to use our long-used object dtype implementation. What was the error you got?

will re-restore the fallback to find out.

FWIW it would help in reviewing if you pushed additional commits instead of reverting/force pushing, then it is clearer what you actually tried and what the CI said

ive been rebasing (instead of merging main like usual) on the theory it would make backporting easier. if that theory is mistaken, ill go back to the usual system.

@jorisvandenbossche
Copy link
Member

ive been rebasing (instead of merging main like usual)

Also when you add new commits for any change you make, you can still use rebase instead of merge to update with the latest main, if you prefer that

on the theory it would make backporting easier.

PRs are always squashed into a single commit on top of main when merging, so I don't think this has any impact on backporting ease

@jorisvandenbossche
Copy link
Member

Just pushed one small additional case that wasn't covered yet (one that was failing before with StringDtype as well)

@jorisvandenbossche jorisvandenbossche merged commit 50ac190 into pandas-dev:main Sep 10, 2024
47 checks passed
@jorisvandenbossche
Copy link
Member

Thanks!

@jbrockmendel jbrockmendel deleted the bug-str-slice branch September 10, 2024 14:08
jorisvandenbossche added a commit to jorisvandenbossche/pandas that referenced this pull request Oct 10, 2024
jorisvandenbossche added a commit that referenced this pull request Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported Strings String extension data type and string data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API/BUG: obj.str.slice(start:None:-1)
2 participants