@@ -1704,6 +1704,11 @@ def _is_scalar_access(self, key: Tuple):
1704
1704
if isinstance (ax , MultiIndex ):
1705
1705
return False
1706
1706
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
+
1707
1712
if not ax .is_unique :
1708
1713
return False
1709
1714
@@ -1719,7 +1724,10 @@ def _get_partial_string_timestamp_match_key(self, key, labels):
1719
1724
"""Translate any partial string timestamp matches in key, returning the
1720
1725
new key (GH 10331)"""
1721
1726
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
+ ):
1723
1731
# Convert key '2016-01-01' to
1724
1732
# ('2016-01-01'[, slice(None, None, None)]+)
1725
1733
key = tuple ([key ] + [slice (None )] * (len (labels .levels ) - 1 ))
@@ -1729,7 +1737,10 @@ def _get_partial_string_timestamp_match_key(self, key, labels):
1729
1737
# (..., slice('2016-01-01', '2016-01-01', None), ...)
1730
1738
new_key = []
1731
1739
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
+ ):
1733
1744
new_key .append (slice (component , component , None ))
1734
1745
else :
1735
1746
new_key .append (component )
@@ -2334,7 +2345,7 @@ def convert_to_index_sliceable(obj, key):
2334
2345
2335
2346
# We might have a datetimelike string that we can translate to a
2336
2347
# slice here via partial string indexing
2337
- if idx .is_all_dates :
2348
+ if idx ._supports_partial_string_indexing :
2338
2349
try :
2339
2350
return idx ._get_string_slice (key )
2340
2351
except (KeyError , ValueError , NotImplementedError ):
0 commit comments