File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ Strings
197197Indexing
198198^^^^^^^^
199199
200- -
200+ - The traceback from a ``KeyError`` when asking ``.loc`` for a single missing label is now shorter and more clear (:issue:`21557`)
201201-
202202-
203203
Original file line number Diff line number Diff line change @@ -1807,8 +1807,6 @@ def error():
18071807
18081808 try :
18091809 key = self ._convert_scalar_indexer (key , axis )
1810- if not ax .contains (key ):
1811- error ()
18121810 except TypeError as e :
18131811
18141812 # python 3 type errors should be raised
@@ -1818,6 +1816,9 @@ def error():
18181816 except :
18191817 error ()
18201818
1819+ if not ax .contains (key ):
1820+ error ()
1821+
18211822 def _is_scalar_access (self , key ):
18221823 # this is a shortcut accessor to both .loc and .iloc
18231824 # that provide the equivalent access of .at and .iat
You can’t perform that action at this time.
0 commit comments