@@ -1704,6 +1704,11 @@ def _is_scalar_access(self, key: Tuple):
17041704 if isinstance (ax , MultiIndex ):
17051705 return False
17061706
1707+ if isinstance (k , str ) and ax ._supports_partial_string_indexing :
1708+ # partial string indexing, df.loc['2000', 'A']
1709+ # should not be considered scalar
1710+ return False
1711+
17071712 if not ax .is_unique :
17081713 return False
17091714
@@ -1719,7 +1724,10 @@ def _get_partial_string_timestamp_match_key(self, key, labels):
17191724 """Translate any partial string timestamp matches in key, returning the
17201725 new key (GH 10331)"""
17211726 if isinstance (labels , MultiIndex ):
1722- if isinstance (key , str ) and labels .levels [0 ].is_all_dates :
1727+ if (
1728+ isinstance (key , str )
1729+ and labels .levels [0 ]._supports_partial_string_indexing
1730+ ):
17231731 # Convert key '2016-01-01' to
17241732 # ('2016-01-01'[, slice(None, None, None)]+)
17251733 key = tuple ([key ] + [slice (None )] * (len (labels .levels ) - 1 ))
@@ -1729,7 +1737,10 @@ def _get_partial_string_timestamp_match_key(self, key, labels):
17291737 # (..., slice('2016-01-01', '2016-01-01', None), ...)
17301738 new_key = []
17311739 for i , component in enumerate (key ):
1732- if isinstance (component , str ) and labels .levels [i ].is_all_dates :
1740+ if (
1741+ isinstance (component , str )
1742+ and labels .levels [i ]._supports_partial_string_indexing
1743+ ):
17331744 new_key .append (slice (component , component , None ))
17341745 else :
17351746 new_key .append (component )
@@ -2334,7 +2345,7 @@ def convert_to_index_sliceable(obj, key):
23342345
23352346 # We might have a datetimelike string that we can translate to a
23362347 # slice here via partial string indexing
2337- if idx .is_all_dates :
2348+ if idx ._supports_partial_string_indexing :
23382349 try :
23392350 return idx ._get_string_slice (key )
23402351 except (KeyError , ValueError , NotImplementedError ):
0 commit comments