BUG/TST: fix several issues with slice bound checking code by immerrr · Pull Request #6531 · pandas-dev/pandas (original) (raw)
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:
if start >= l: return self._getitem_axis(tuple(),axis=axis)
CLN: #6299 & #6443 rendered core.indexing._check_slice_bounds function useless and it's now gone. Next step would be to drop unused raise_on_error parameter in slice-related functions.
Not sure, how do I put down all these relations into changelog, advice on that is welcome.