-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG/TST: fix several issues with slice bound checking code #6531
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
BUG/TST: fix several issues with slice bound checking code #6531
Conversation
you can drop the raise_on_error parameter as it was just something to 'fix' the slicing issues (from somewhere in 0.12-0.13 transition). Just put this all in a single line in API changes (its not really an API change, but more prominent), list all of the related issues. |
Did I get you correctly: immerrr@c7e6345#diff-5a809a5e093be4fe1396cbadd5bbeccaR110 ? |
tep |
yep |
Ok, folding/rebasing it then. |
minor change I think you can move _slice from frame/panel to generic (but series still overrides) |
Whoops, apparently I've accidentally deleted wrong gh branch when cleaning up local ones, sorry about that. |
Also, |
can you rebase on currentmaster and push again.thxs |
BUG/TST: fix handling of slice.stop < -len, obj.iloc[:-len(obj)] should be empty BUG/TST: fix exceptions raised by Series.iloc when slice.start > len CLN: remove unused _check_slice_bound function and raise_on_error params
Ok, done. |
BUG/TST: fix several issues with slice bound checking code
thanks as always! if you are interestdd #6536 |
Sure, that was a low hanging fruit :) |
This patch removes more of what's left after removing pandas-specific customizations to slice indexing.
BUG/TST:
obj.iloc[:,-4:-10]
should return empty slice (because slice.step > 0 and slice.start > slice.stop)There's no way to describe this by setting stop to a value in
[0; len]
interval, it should remain negative (see this ticket in python bugtracker]. Proposed fix to this issue is to remove the custom logic altogether. A side-effect of that is correct handling of negative steps in presence of out-of-bounds slices, e.g.obj.iloc[:,10:4:-1]
would've incorrectly returned empty slice.BUG: fix exception raised by
Series([1,2,3]).iloc[10:]
.After I've cleaned up suspicious code that handled empty-sequence keys in #6440, this piece of code started causing trouble:
CLN: #6299 & #6443 rendered
core.indexing._check_slice_bounds
function useless and it's now gone. Next step would be to drop unusedraise_on_error
parameter in slice-related functions.Not sure, how do I put down all these relations into changelog, advice on that is welcome.