Skip to content

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

Closed
wants to merge 2 commits into from

Conversation

chris-b1
Copy link
Contributor

cc @shoyer - good diagnosis!

@chris-b1 chris-b1 changed the title BUG: date slicing with rev index BUG: date slicing with reverse sorted index Sep 29, 2016
@@ -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
Copy link
Member

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)

Copy link
Contributor Author

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.

@codecov-io
Copy link

codecov-io commented Sep 29, 2016

Current coverage is 85.26% (diff: 100%)

Merging #14317 into master will increase coverage by <.01%

@@             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          

Powered by Codecov. Last update 5033a4a...04feea1

@jreback jreback added Bug Datetime Datetime data dtype labels Sep 29, 2016
return bounds[0 if side == 'left' else 1]
bounds_side = 0 if side == 'left' else 1
if self.is_monotonic_decreasing:
# swap edges
Copy link
Contributor

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

@jreback
Copy link
Contributor

jreback commented Sep 29, 2016

lgtm. minor comment. merge when ready.

@jreback jreback added this to the 0.19.0 milestone Sep 29, 2016
@jreback jreback closed this in ad92aee Sep 30, 2016
@jreback
Copy link
Contributor

jreback commented Sep 30, 2016

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slicing with reversed datetime index
5 participants