File tree 2 files changed +4
-3
lines changed
2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ Strings
197
197
Indexing
198
198
^^^^^^^^
199
199
200
- -
200
+ - The traceback from a ``KeyError`` when asking ``.loc`` for a single missing label is now shorter and more clear (:issue:`21557`)
201
201
-
202
202
-
203
203
Original file line number Diff line number Diff line change @@ -1807,8 +1807,6 @@ def error():
1807
1807
1808
1808
try :
1809
1809
key = self ._convert_scalar_indexer (key , axis )
1810
- if not ax .contains (key ):
1811
- error ()
1812
1810
except TypeError as e :
1813
1811
1814
1812
# python 3 type errors should be raised
@@ -1818,6 +1816,9 @@ def error():
1818
1816
except :
1819
1817
error ()
1820
1818
1819
+ if not ax .contains (key ):
1820
+ error ()
1821
+
1821
1822
def _is_scalar_access (self , key ):
1822
1823
# this is a shortcut accessor to both .loc and .iloc
1823
1824
# that provide the equivalent access of .at and .iat
You can’t perform that action at this time.
0 commit comments