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

Change IntervalIndex set-ops error code type #19329

merged 1 commit into from Jan 21, 2018


None yet
2 participants

topper-123 commented Jan 21, 2018

  • xref #19021
  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

Set operations (union, difference...) on IntervalIndex with incompatible index types will now raise a TypeError rather than a ValueError.

This PR is needed to make the changes requested in #19021.

EDIT: I've improved the error message also. Previously, you'd get:

>>> pd.IntervalIndex.from_breaks([0,1,2,3]).union(pd.RangeIndex(3))
ValueError: can only do set operations between two IntervalIndex objects that are closed on the same side

Which made no sense in this case. Now we get:

>>> pd.IntervalIndex.from_breaks([0,1,2,3]).union(pd.RangeIndex(3))
TypeError: the other index needs to be an IntervalIndex too, but was type RangeIndex

@topper-123 topper-123 changed the title from Change IntervalIndex set-ops eror code type to Change IntervalIndex set-ops error code type Jan 21, 2018


This comment has been minimized.

codecov bot commented Jan 21, 2018

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #19329      +/-   ##
+ Coverage   91.53%   91.53%   +<.01%     
  Files         150      150              
  Lines       48739    48741       +2     
+ Hits        44612    44614       +2     
  Misses       4127     4127
Flag Coverage Δ
#multiple 89.9% <100%> (ø) ⬆️
#single 41.72% <0%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/core/indexes/ 92.4% <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 1245f06...c75e6de. Read the comment docs.

@jreback jreback added this to the 0.23.0 milestone Jan 21, 2018

@jreback jreback merged commit 4003a74 into pandas-dev:master Jan 21, 2018

2 of 3 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
ci/circleci Your tests passed on CircleCI!
continuous-integration/appveyor/pr AppVeyor build succeeded

This comment has been minimized.


jreback commented Jan 21, 2018

thanks @topper-123

can rebase #19021 and tests should be much simpler. ping when ready on that one.

@topper-123 topper-123 deleted the topper-123:Interval.py_ValueError_to_TypeError_II branch Jan 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment