@@ -882,17 +882,21 @@ def _getitem_nested_tuple(self, tup: tuple):
882
882
if self .name != "loc" :
883
883
# This should never be reached, but lets be explicit about it
884
884
raise ValueError ("Too many indices" )
885
- if isinstance (self .obj , ABCSeries ) and any (
886
- isinstance (k , tuple ) for k in tup
887
- ):
888
- # GH#35349 Raise if tuple in tuple for series
889
- raise ValueError ("Too many indices" )
890
885
if all (is_hashable (x ) or com .is_null_slice (x ) for x in tup ):
891
886
# GH#10521 Series should reduce MultiIndex dimensions instead of
892
887
# DataFrame, IndexingError is not raised when slice(None,None,None)
893
888
# with one row.
894
889
with suppress (IndexingError ):
895
890
return self ._handle_lowerdim_multi_index_axis0 (tup )
891
+ elif isinstance (self .obj , ABCSeries ) and any (
892
+ isinstance (k , tuple ) for k in tup
893
+ ):
894
+ # GH#35349 Raise if tuple in tuple for series
895
+ # Do this after the all-hashable-or-null-slice check so that
896
+ # we are only getting non-hashable tuples, in particular ones
897
+ # that themselves contain a slice entry
898
+ # See test_loc_series_getitem_too_many_dimensions
899
+ raise ValueError ("Too many indices" )
896
900
897
901
# this is a series with a multi-index specified a tuple of
898
902
# selectors
@@ -1127,6 +1131,9 @@ def _handle_lowerdim_multi_index_axis0(self, tup: tuple):
1127
1131
return self ._get_label (tup , axis = axis )
1128
1132
except TypeError as err :
1129
1133
# slices are unhashable
1134
+ # FIXME: this raises when we have a DatetimeIndex first level and a
1135
+ # string for the first tup entry
1136
+ # see test_partial_slicing_with_multiindex
1130
1137
raise IndexingError ("No label returned" ) from err
1131
1138
1132
1139
except KeyError as ek :
0 commit comments