@@ -943,10 +943,12 @@ def _ixs(self, i: int, axis: AxisInt = 0) -> Any:
943
943
"""
944
944
return self ._values [i ]
945
945
946
- def _slice (self , slobj : slice | np . ndarray , axis : Axis = 0 ) -> Series :
946
+ def _slice (self , slobj : slice , axis : AxisInt = 0 ) -> Series :
947
947
# axis kwarg is retained for compat with NDFrame method
948
948
# _slice is *always* positional
949
- return self ._get_values (slobj )
949
+ mgr = self ._mgr .get_slice (slobj , axis = axis )
950
+ out = self ._constructor (mgr , fastpath = True )
951
+ return out .__finalize__ (self )
950
952
951
953
def __getitem__ (self , key ):
952
954
check_dict_or_set_indexers (key )
@@ -983,10 +985,7 @@ def __getitem__(self, key):
983
985
984
986
if isinstance (key , slice ):
985
987
# Do slice check before somewhat-costly is_bool_indexer
986
- # _convert_slice_indexer to determine if this slice is positional
987
- # or label based, and if the latter, convert to positional
988
- slobj = self .index ._convert_slice_indexer (key , kind = "getitem" )
989
- return self ._slice (slobj )
988
+ return self ._getitem_slice (key )
990
989
991
990
if is_iterator (key ):
992
991
key = list (key )
0 commit comments