Skip to content

Fix string slice indexing for a length-1 CFTimeIndex #2166

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 3 commits into from
May 21, 2018

Conversation

spencerkclark
Copy link
Member

@spencerkclark spencerkclark commented May 21, 2018

  • Closes CFTimeIndex improperly handles string slice for length-1 indexes #2165
  • Tests added (for all bug fixes or enhancements)
  • Tests passed (for all non-documentation changes)
  • Fully documented, including whats-new.rst for all changes and api.rst for new API (remove if this change should not be visible to users, e.g., if it is an internal clean-up, or if this is part of a larger project that will be documented later)

The issue is that both is_monotonic_decreasing and is_monotonic_increasing return True for a length-1 index; therefore an additional check is needed to make sure the length of the index is greater than 1 in CFTimeIndex._maybe_cast_slice_bound. This is similar to how things are done in DatetimeIndex._maybe_cast_slice_bound in pandas.

@shoyer shoyer merged commit 48d55ee into pydata:master May 21, 2018
@shoyer
Copy link
Member

shoyer commented May 21, 2018

thanks!

@spencerkclark spencerkclark deleted the single-element-cftimeindex branch May 21, 2018 10:51
@shoyer shoyer mentioned this pull request May 25, 2018
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CFTimeIndex improperly handles string slice for length-1 indexes
2 participants