Skip to content

Commit f4c43e3

Browse files
Make first two tests pass
1 parent 564d88d commit f4c43e3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pandas/core/indexes/interval.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -766,8 +766,13 @@ def get_loc(self, key, method=None):
766766
key = Interval(left, right, key.closed)
767767
else:
768768
key = self._maybe_cast_slice_bound(key, 'left', None)
769-
770-
start, stop = self._find_non_overlapping_monotonic_bounds(key)
769+
try:
770+
start, stop = self._find_non_overlapping_monotonic_bounds(key)
771+
except TypeError:
772+
# get loc should raise KeyError
773+
# if key is hashable but
774+
# of an incorrect type
775+
raise KeyError
771776

772777
if start is None or stop is None:
773778
return slice(start, stop)

0 commit comments

Comments
 (0)