@@ -1743,12 +1743,14 @@ def _get_slice_axis(self, slice_obj: slice, axis: int):
1743
1743
1744
1744
1745
1745
class _LocationIndexer (_NDFrameIndexer ):
1746
+ _takeable : bool = False
1747
+
1746
1748
def __getitem__ (self , key ):
1747
1749
if type (key ) is tuple :
1748
1750
key = tuple (com .apply_if_callable (x , self .obj ) for x in key )
1749
1751
if self ._is_scalar_access (key ):
1750
1752
try :
1751
- return self ._getitem_scalar ( key )
1753
+ return self .obj . _get_value ( * key , takeable = self . _takeable )
1752
1754
except (KeyError , IndexError , AttributeError ):
1753
1755
# AttributeError for IntervalTree get_value
1754
1756
pass
@@ -1763,9 +1765,6 @@ def __getitem__(self, key):
1763
1765
def _is_scalar_access (self , key : Tuple ):
1764
1766
raise NotImplementedError ()
1765
1767
1766
- def _getitem_scalar (self , key ):
1767
- raise NotImplementedError ()
1768
-
1769
1768
def _getitem_axis (self , key , axis : int ):
1770
1769
raise NotImplementedError ()
1771
1770
@@ -1854,12 +1853,6 @@ def _is_scalar_access(self, key: Tuple) -> bool:
1854
1853
1855
1854
return True
1856
1855
1857
- def _getitem_scalar (self , key ):
1858
- # a fast-path to scalar access
1859
- # if not, raise
1860
- values = self .obj ._get_value (* key )
1861
- return values
1862
-
1863
1856
def _get_partial_string_timestamp_match_key (self , key , labels ):
1864
1857
"""
1865
1858
Translate any partial string timestamp matches in key, returning the
@@ -1965,6 +1958,7 @@ class _iLocIndexer(_LocationIndexer):
1965
1958
"point is EXCLUDED), listlike of integers, boolean array"
1966
1959
)
1967
1960
_get_slice_axis = _NDFrameIndexer ._get_slice_axis
1961
+ _takeable = True
1968
1962
1969
1963
def _validate_key (self , key , axis : int ):
1970
1964
if com .is_bool_indexer (key ):
@@ -2029,12 +2023,6 @@ def _is_scalar_access(self, key: Tuple) -> bool:
2029
2023
2030
2024
return True
2031
2025
2032
- def _getitem_scalar (self , key ):
2033
- # a fast-path to scalar access
2034
- # if not, raise
2035
- values = self .obj ._get_value (* key , takeable = True )
2036
- return values
2037
-
2038
2026
def _validate_integer (self , key : int , axis : int ) -> None :
2039
2027
"""
2040
2028
Check that 'key' is a valid position in the desired axis.
0 commit comments