@@ -866,16 +866,7 @@ def _validate_key(self, key, axis: int):
866
866
# slice of labels (where start-end in labels)
867
867
# slice of integers (only if in the labels)
868
868
# boolean
869
-
870
- if isinstance (key , slice ):
871
- return
872
-
873
- if com .is_bool_indexer (key ):
874
- return
875
-
876
- if not is_list_like_indexer (key ):
877
- labels = self .obj ._get_axis (axis )
878
- labels ._convert_scalar_indexer (key , kind = "loc" )
869
+ pass
879
870
880
871
def _has_valid_setitem_indexer (self , indexer ) -> bool :
881
872
return True
@@ -1139,15 +1130,6 @@ def _convert_to_indexer(self, key, axis: int, is_setter: bool = False):
1139
1130
if isinstance (key , slice ):
1140
1131
return labels ._convert_slice_indexer (key , kind = "loc" )
1141
1132
1142
- if is_scalar (key ):
1143
- # try to find out correct indexer, if not type correct raise
1144
- try :
1145
- key = labels ._convert_scalar_indexer (key , kind = "loc" )
1146
- except KeyError :
1147
- # but we will allow setting
1148
- if not is_setter :
1149
- raise
1150
-
1151
1133
# see if we are positional in nature
1152
1134
is_int_index = labels .is_integer ()
1153
1135
is_int_positional = is_integer (key ) and not is_int_index
@@ -2029,11 +2011,17 @@ def _convert_key(self, key, is_setter: bool = False):
2029
2011
if is_setter :
2030
2012
return list (key )
2031
2013
2032
- lkey = list (key )
2033
- for n , (ax , i ) in enumerate (zip (self .obj .axes , key )):
2034
- lkey [n ] = ax ._convert_scalar_indexer (i , kind = "loc" )
2014
+ return key
2035
2015
2036
- return tuple (lkey )
2016
+ def __getitem__ (self , key ):
2017
+ if self .ndim != 1 or not is_scalar (key ):
2018
+ # FIXME: is_scalar check is a kludge
2019
+ return super ().__getitem__ (key )
2020
+
2021
+ # Like Index.get_value, but we do not allow positional fallback
2022
+ obj = self .obj
2023
+ loc = obj .index .get_loc (key )
2024
+ return obj .index ._get_values_for_loc (obj , loc , key )
2037
2025
2038
2026
2039
2027
@Appender (IndexingMixin .iat .__doc__ )
0 commit comments