123
123
ABCDatetimeIndex ,
124
124
ABCMultiIndex ,
125
125
ABCPeriodIndex ,
126
- ABCRangeIndex ,
127
126
ABCSeries ,
128
127
ABCTimedeltaIndex ,
129
128
)
@@ -4213,7 +4212,7 @@ def _validate_positional_slice(self, key: slice) -> None:
4213
4212
self ._validate_indexer ("positional" , key .stop , "iloc" )
4214
4213
self ._validate_indexer ("positional" , key .step , "iloc" )
4215
4214
4216
- def _convert_slice_indexer (self , key : slice , kind : str_t , is_frame : bool = False ):
4215
+ def _convert_slice_indexer (self , key : slice , kind : str_t ):
4217
4216
"""
4218
4217
Convert a slice indexer.
4219
4218
@@ -4224,9 +4223,6 @@ def _convert_slice_indexer(self, key: slice, kind: str_t, is_frame: bool = False
4224
4223
----------
4225
4224
key : label of the slice bound
4226
4225
kind : {'loc', 'getitem'}
4227
- is_frame : bool, default False
4228
- Whether this is a slice called on DataFrame.__getitem__
4229
- as opposed to Series.__getitem__
4230
4226
"""
4231
4227
assert kind in ["loc" , "getitem" ], kind
4232
4228
@@ -4248,46 +4244,7 @@ def is_int(v):
4248
4244
is_positional = is_index_slice and ints_are_positional
4249
4245
4250
4246
if kind == "getitem" :
4251
- """
4252
- called from the getitem slicers, validate that we are in fact
4253
- integers
4254
- """
4255
- if self .is_integer ():
4256
- if is_frame :
4257
- # unambiguously positional, no deprecation
4258
- pass
4259
- elif start is None and stop is None :
4260
- # label-based vs positional is irrelevant
4261
- pass
4262
- elif isinstance (self , ABCRangeIndex ) and self ._range == range (
4263
- len (self )
4264
- ):
4265
- # In this case there is no difference between label-based
4266
- # and positional, so nothing will change.
4267
- pass
4268
- elif (
4269
- self .dtype .kind in ["i" , "u" ]
4270
- and self ._is_strictly_monotonic_increasing
4271
- and len (self ) > 0
4272
- and self [0 ] == 0
4273
- and self [- 1 ] == len (self ) - 1
4274
- ):
4275
- # We are range-like, e.g. created with Index(np.arange(N))
4276
- pass
4277
- elif not is_index_slice :
4278
- # we're going to raise, so don't bother warning, e.g.
4279
- # test_integer_positional_indexing
4280
- pass
4281
- else :
4282
- warnings .warn (
4283
- "The behavior of `series[i:j]` with an integer-dtype index "
4284
- "is deprecated. In a future version, this will be treated "
4285
- "as *label-based* indexing, consistent with e.g. `series[i]` "
4286
- "lookups. To retain the old behavior, use `series.iloc[i:j]`. "
4287
- "To get the future behavior, use `series.loc[i:j]`." ,
4288
- FutureWarning ,
4289
- stacklevel = find_stack_level (),
4290
- )
4247
+ # called from the getitem slicers, validate that we are in fact integers
4291
4248
if self .is_integer () or is_index_slice :
4292
4249
# Note: these checks are redundant if we know is_index_slice
4293
4250
self ._validate_indexer ("slice" , key .start , "getitem" )
0 commit comments