BUG: IntervalIndex.get_loc/get_indexer wrong return value / error
State: closed

- [x] closes #25087
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves
name: Interval
description: Interval data type

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25090?src=pr&el=h1) Report
> Merging [#25090](https://codecov.io/gh/pandas-dev/pandas/pull/25090?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/bb43726e1f52a0ddee45fcf485690719f262870d?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/25090/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/25090?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #25090   +/-   ##
=======================================
  Coverage   92.37%   92.37%           
=======================================
  Files         166      166           
  Lines       52420    52420           
=======================================
  Hits        48423    48423           
  Misses       3997     3997
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.79% <100%> (ø)` | :arrow_up: |
| #single | `42.88% <100%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/25090?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/25090/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `96.82% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25090?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25090?src=pr&el=footer). Last update [bb43726...f357101](https://codecov.io/gh/pandas-dev/pandas/pull/25090?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25090?src=pr&el=h1) Report
> Merging [#25090](https://codecov.io/gh/pandas-dev/pandas/pull/25090?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/324bb84c8e4c84b4103e9b2bdda2d99e8ef549db?src=pr&el=desc) will **increase** coverage by `0.41%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/25090/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/25090?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #25090      +/-   ##
==========================================
+ Coverage   91.48%   91.89%   +0.41%     
==========================================
  Files         175      175              
  Lines       52885    52495     -390     
==========================================
- Hits        48380    48241     -139     
+ Misses       4505     4254     -251
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.45% <100%> (+0.4%)` | :arrow_up: |
| #single | `40.74% <0%> (-1.09%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/25090?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/interval.py](https://codecov.io/gh/pandas-dev/pandas/pull/25090/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9pbnRlcnZhbC5weQ==) | `95.56% <100%> (+0.3%)` | :arrow_up: |
| [pandas/io/clipboard/\_\_init\_\_.py](https://codecov.io/gh/pandas-dev/pandas/pull/25090/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2NsaXBib2FyZC9fX2luaXRfXy5weQ==) | `39.21% <0%> (-17.65%)` | :arrow_down: |
| [pandas/io/clipboard/clipboards.py](https://codecov.io/gh/pandas-dev/pandas/pull/25090/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2NsaXBib2FyZC9jbGlwYm9hcmRzLnB5) | `18.51% <0%> (-12.07%)` | :arrow_down: |
| [pandas/plotting/\_compat.py](https://codecov.io/gh/pandas-dev/pandas/pull/25090/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb21wYXQucHk=) | `83.33% <0%> (-4.17%)` | :arrow_down: |
| [pandas/core/config\_init.py](https://codecov.io/gh/pandas-dev/pandas/pull/25090/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29uZmlnX2luaXQucHk=) | `96.96% <0%> (-2.24%)` | :arrow_down: |
| [pandas/plotting/\_style.py](https://codecov.io/gh/pandas-dev/pandas/pull/25090/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19zdHlsZS5weQ==) | `77.17% <0%> (-0.49%)` | :arrow_down: |
| [pandas/compat/numpy/\_\_init\_\_.py](https://codecov.io/gh/pandas-dev/pandas/pull/25090/diff?src=pr&el=tree#diff-cGFuZGFzL2NvbXBhdC9udW1weS9fX2luaXRfXy5weQ==) | `92.85% <0%> (-0.48%)` | :arrow_down: |
| [pandas/core/groupby/grouper.py](https://codecov.io/gh/pandas-dev/pandas/pull/25090/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS9ncm91cGVyLnB5) | `98.18% <0%> (-0.35%)` | :arrow_down: |
| [pandas/core/computation/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/25090/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vcHl0YWJsZXMucHk=) | `90.24% <0%> (-0.31%)` | :arrow_down: |
| [pandas/plotting/\_misc.py](https://codecov.io/gh/pandas-dev/pandas/pull/25090/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19taXNjLnB5) | `38.46% <0%> (-0.23%)` | :arrow_down: |
| ... and [93 more](https://codecov.io/gh/pandas-dev/pandas/pull/25090/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25090?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25090?src=pr&el=footer). Last update [324bb84...9f6b5c0](https://codecov.io/gh/pandas-dev/pandas/pull/25090?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Hello @samuelsinayoko! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:







There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2019-04-10 07:20:10 UTC
xref: https://github.com/pandas-dev/pandas/pull/25091, https://github.com/pandas-dev/pandas/issues/25087
Thanks!  To provide some additional context here: the indexing methods for `IntervalIndex` are currently in flux and a bit of a mess.  There are specs to change the behavior (xref #16316) that I've been working through, albeit slowly due to not having much free time lately.  In the process of doing so I've also been addressing stuff like this, removing the need for separate `is_non_overlapping_monotonic` branches, and generally cleaning things up.

That being said, this is still something that'd be viable for a 0.24.x change, since the new specs require breaking changes and would need to go in a major release (aiming for 0.25.0).
Any tips on making the tests pass on macOS, windows and Linux py27? 
@samuelsinayoko do those tests fail for you locally? If not, I can take a look later.
will take another look at this tomorrow

On Thu, 7 Mar 2019 at 18:00, Tom Augspurger <notifications@github.com>
wrote:

> @samuelsinayoko <https://github.com/samuelsinayoko> do those tests fail
> for you locally? If not, I can take a look later.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/25090#issuecomment-470630333>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AQuwvnphRf-gB8HLdg_PKKyjG_Yfqc15ks5vUVOkgaJpZM4afkZ_>
> .
>


-- 

*Sam Sinayoko* | Data Scientist

*BMLL Technologies Ltd.*

10th Floor – Portland House

Bressenden Place

London

SW1E 5RS

+44(0)20 3828 9020

@TomAugspurger yes the tests pass locally on my linux machine. Not sure what's happening on Windows and OSX, so would be grateful for any help on this. 
@samuelsinayoko can you merge master? Recently dropped Py2 support so should make things easier
Ok will do
@samuelsinayoko can you merge mater and update
closing as stale, if you'd like to continue, pls ping.