Skip to content

Commit 7127fb1

Browse files
committed
Remove code
1 parent 3708f38 commit 7127fb1

File tree

4 files changed

+10
-16
lines changed

4 files changed

+10
-16
lines changed

pandas/core/indexes/category.py

-4
Original file line numberDiff line numberDiff line change
@@ -582,10 +582,6 @@ def _convert_list_indexer(self, keyarr):
582582
# Return our indexer or raise if all of the values are not included in
583583
# the categories
584584

585-
if self.categories._defer_to_indexing:
586-
indexer = self.categories._convert_list_indexer(keyarr)
587-
return Index(self.codes).get_indexer_for(indexer)
588-
589585
msg = "a list-indexer must only include values that are in the categories"
590586
if self.hasnans:
591587
msg += " or NA"

pandas/core/indexes/interval.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -841,13 +841,7 @@ def _convert_list_indexer(self, keyarr):
841841
we are passed a list-like indexer. Return the
842842
indexer for matching intervals.
843843
"""
844-
locs = self.get_indexer_for(keyarr)
845-
846-
# we have missing values
847-
if (locs == -1).any():
848-
raise KeyError(keyarr[locs == -1].tolist())
849-
850-
return locs
844+
return self.get_indexer_for(keyarr)
851845

852846
# --------------------------------------------------------------------
853847

pandas/tests/indexing/interval/test_interval.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,13 @@ def test_non_matching(self):
6565

6666
# this is a departure from our current
6767
# indexing scheme, but simpler
68-
with pytest.raises(KeyError, match=r"^\[-1\]$"):
68+
msg = r"Passing list-likes to \.loc or \[\] with any missing labels is no " \
69+
r"longer supported. The following labels were missing: " \
70+
r"Int64Index\(\[-1\], dtype='int64'\)"
71+
with pytest.raises(KeyError, match=msg):
6972
s.loc[[-1, 3, 4, 5]]
7073

71-
with pytest.raises(KeyError, match=r"^\[-1\]$"):
74+
with pytest.raises(KeyError, match=msg):
7275
s.loc[[-1, 3]]
7376

7477
@pytest.mark.arm_slow

pandas/tests/indexing/interval/test_interval_new.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,15 @@ def test_loc_with_overlap(self):
203203

204204
with pytest.raises(KeyError, match=re.escape("Interval(3, 5, closed='right')")):
205205
s.loc[Interval(3, 5)]
206-
207-
with pytest.raises(KeyError, match=r"^\[Interval\(3, 5, closed='right'\)\]$"):
206+
msg = r"None of \[IntervalIndex\(\[\(3, 5\]\],\\n \s* closed='right',\\n \s* " \
207+
r"dtype='interval\[int64\]'\)\] are in the \[index\]"
208+
with pytest.raises(KeyError, match=msg):
208209
s.loc[[Interval(3, 5)]]
209210

210211
with pytest.raises(KeyError, match=re.escape("Interval(3, 5, closed='right')")):
211212
s[Interval(3, 5)]
212213

213-
with pytest.raises(KeyError, match=r"^\[Interval\(3, 5, closed='right'\)\]$"):
214+
with pytest.raises(KeyError, match=msg):
214215
s[[Interval(3, 5)]]
215216

216217
# slices with interval (only exact matches)

0 commit comments

Comments
 (0)