-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: date slicing with reverse sorted index #14317
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
Conversation
@@ -1447,7 +1447,11 @@ def _maybe_cast_slice_bound(self, label, side, kind): | |||
getattr(self, 'inferred_freq', None)) | |||
_, parsed, reso = parse_time_string(label, freq) | |||
bounds = self._parsed_string_to_bounds(reso, parsed) | |||
return bounds[0 if side == 'left' else 1] | |||
bounds_side = 0 if side == 'left' else 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't really clearer, but it does save a few lines:
bounds_side = int((side == 'left') != self.is_monotonic_decreasing)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shoyer - I ended up writing this a bit differently, unpacking bounds
into 2 names. Let me know if you think it could be any clearer.
Current coverage is 85.26% (diff: 100%)@@ master #14317 diff @@
==========================================
Files 140 140
Lines 50619 50621 +2
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 43161 43163 +2
Misses 7458 7458
Partials 0 0
|
return bounds[0 if side == 'left' else 1] | ||
bounds_side = 0 if side == 'left' else 1 | ||
if self.is_monotonic_decreasing: | ||
# swap edges |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would add a comment n why you are doing this
lgtm. minor comment. merge when ready. |
thanks! |
git diff upstream/master | flake8 --diff
cc @shoyer - good diagnosis!