Skip to content
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: IntervalIndex is_non_overlapping_monotonic is incorrect when endpoints are closed on both sides #16588

Closed
wants to merge 2 commits into from

Conversation

alysivji
Copy link
Contributor

@alysivji alysivji commented Jun 2, 2017

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some changes. add a whatsnew note. 0.21.0 conversion bug fixes

if self.closed == 'both':
return ((self.right[:-1] < self.left[1:]).all() or
(self.left[:-1] > self.right[1:]).all())
else:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use the else here

add a comment on these cases (left/right).

neighter case? (short circuit to False)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working on this now. Why would the neither case short circuit to False? Can't we have intervals [(0, 1), (1, 2)] where it is non-overlapping and also cases where it is overlapping [(0, 1), (.5, 3)]

Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is checking monotonicity as well. so you can do the same for neither.

def test_is_non_overlapping_monotonic(self):
index = IntervalIndex.from_tuples(
[(0, 1), (2, 3), (4, 5)], closed='both')
assert index.is_non_overlapping_monotonic == True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use is True

assert index.is_non_overlapping_monotonic == True

index = IntervalIndex.from_breaks(range(4), closed='both')
assert index.is_non_overlapping_monotonic == False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use is False

@jreback jreback added Bug Interval Interval data type labels Jun 5, 2017
@codecov
Copy link

codecov bot commented Jun 11, 2017

Codecov Report

Merging #16588 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16588      +/-   ##
==========================================
+ Coverage   90.75%   90.75%   +<.01%     
==========================================
  Files         161      161              
  Lines       51097    51099       +2     
==========================================
+ Hits        46372    46374       +2     
  Misses       4725     4725
Flag Coverage Δ
#multiple 88.59% <100%> (ø) ⬆️
#single 40.16% <0%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/core/indexes/interval.py 92.61% <100%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 31e67d5...bdf1146. Read the comment docs.

@codecov
Copy link

codecov bot commented Jun 11, 2017

Codecov Report

Merging #16588 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16588      +/-   ##
==========================================
+ Coverage   90.75%   90.75%   +<.01%     
==========================================
  Files         161      161              
  Lines       51097    51099       +2     
==========================================
+ Hits        46372    46374       +2     
  Misses       4725     4725
Flag Coverage Δ
#multiple 88.59% <100%> (ø) ⬆️
#single 40.16% <0%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/core/indexes/interval.py 92.61% <100%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 31e67d5...bdf1146. Read the comment docs.

@alysivji
Copy link
Contributor Author

Fixed the issues from the review, except for changing == to is in the asserts. Using is resulted in assert errors so I kept it the way it was originally.

Added additional tests and updated the whatsnew section in the docs. Thanks.

@jschendel
Copy link
Member

ping @jreback : This can be closed, as the issue was resolved by #17238

@gfyoung
Copy link
Member

gfyoung commented Sep 9, 2017

@jschendel : Confirmed and closing.

@gfyoung gfyoung closed this Sep 9, 2017
@gfyoung gfyoung modified the milestones: No action, 0.21.0 Sep 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Interval Interval data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IntervalIndex is_non_overlapping_monotonic is incorrect when endpoints are shared
5 participants