@@ -3142,6 +3142,15 @@ def _convert_scalar_indexer(self, key, kind: str_t):
3142
3142
3143
3143
return key
3144
3144
3145
+ def _validate_positional_slice (self , key : slice ):
3146
+ """
3147
+ For positional indexing, a slice must have either int or None
3148
+ for each of start, stop, and step.
3149
+ """
3150
+ self ._validate_indexer ("positional" , key .start , "iloc" )
3151
+ self ._validate_indexer ("positional" , key .stop , "iloc" )
3152
+ self ._validate_indexer ("positional" , key .step , "iloc" )
3153
+
3145
3154
def _convert_slice_indexer (self , key : slice , kind = None ):
3146
3155
"""
3147
3156
Convert a slice indexer.
@@ -3152,16 +3161,9 @@ def _convert_slice_indexer(self, key: slice, kind=None):
3152
3161
Parameters
3153
3162
----------
3154
3163
key : label of the slice bound
3155
- kind : {'loc', 'getitem', 'iloc' } or None
3164
+ kind : {'loc', 'getitem'} or None
3156
3165
"""
3157
- assert kind in ["loc" , "getitem" , "iloc" , None ]
3158
-
3159
- # validate iloc
3160
- if kind == "iloc" :
3161
- self ._validate_indexer ("positional" , key .start , "iloc" )
3162
- self ._validate_indexer ("positional" , key .stop , "iloc" )
3163
- self ._validate_indexer ("positional" , key .step , "iloc" )
3164
- return key
3166
+ assert kind in ["loc" , "getitem" , None ], kind
3165
3167
3166
3168
# potentially cast the bounds to integers
3167
3169
start , stop , step = key .start , key .stop , key .step
0 commit comments