@@ -1726,6 +1726,11 @@ def _is_scalar_access(self, key: Tuple):
1726
1726
if isinstance (ax , MultiIndex ):
1727
1727
return False
1728
1728
1729
+ if isinstance (k , str ) and ax ._supports_partial_string_indexing :
1730
+ # partial string indexing, df.loc['2000', 'A']
1731
+ # should not be considered scalar
1732
+ return False
1733
+
1729
1734
if not ax .is_unique :
1730
1735
return False
1731
1736
@@ -1741,7 +1746,10 @@ def _get_partial_string_timestamp_match_key(self, key, labels):
1741
1746
"""Translate any partial string timestamp matches in key, returning the
1742
1747
new key (GH 10331)"""
1743
1748
if isinstance (labels , MultiIndex ):
1744
- if isinstance (key , str ) and labels .levels [0 ].is_all_dates :
1749
+ if (
1750
+ isinstance (key , str )
1751
+ and labels .levels [0 ]._supports_partial_string_indexing
1752
+ ):
1745
1753
# Convert key '2016-01-01' to
1746
1754
# ('2016-01-01'[, slice(None, None, None)]+)
1747
1755
key = tuple ([key ] + [slice (None )] * (len (labels .levels ) - 1 ))
@@ -1751,7 +1759,10 @@ def _get_partial_string_timestamp_match_key(self, key, labels):
1751
1759
# (..., slice('2016-01-01', '2016-01-01', None), ...)
1752
1760
new_key = []
1753
1761
for i , component in enumerate (key ):
1754
- if isinstance (component , str ) and labels .levels [i ].is_all_dates :
1762
+ if (
1763
+ isinstance (component , str )
1764
+ and labels .levels [i ]._supports_partial_string_indexing
1765
+ ):
1755
1766
new_key .append (slice (component , component , None ))
1756
1767
else :
1757
1768
new_key .append (component )
@@ -2340,7 +2351,7 @@ def convert_to_index_sliceable(obj, key):
2340
2351
2341
2352
# We might have a datetimelike string that we can translate to a
2342
2353
# slice here via partial string indexing
2343
- if idx .is_all_dates :
2354
+ if idx ._supports_partial_string_indexing :
2344
2355
try :
2345
2356
return idx ._get_string_slice (key )
2346
2357
except (KeyError , ValueError , NotImplementedError ):
0 commit comments