123
123
ABCDatetimeIndex ,
124
124
ABCMultiIndex ,
125
125
ABCPeriodIndex ,
126
- ABCRangeIndex ,
127
126
ABCSeries ,
128
127
ABCTimedeltaIndex ,
129
128
)
@@ -3846,7 +3845,7 @@ def _validate_positional_slice(self, key: slice) -> None:
3846
3845
self ._validate_indexer ("positional" , key .stop , "iloc" )
3847
3846
self ._validate_indexer ("positional" , key .step , "iloc" )
3848
3847
3849
- def _convert_slice_indexer (self , key : slice , kind : str_t , is_frame : bool = False ):
3848
+ def _convert_slice_indexer (self , key : slice , kind : str_t ):
3850
3849
"""
3851
3850
Convert a slice indexer.
3852
3851
@@ -3857,9 +3856,6 @@ def _convert_slice_indexer(self, key: slice, kind: str_t, is_frame: bool = False
3857
3856
----------
3858
3857
key : label of the slice bound
3859
3858
kind : {'loc', 'getitem'}
3860
- is_frame : bool, default False
3861
- Whether this is a slice called on DataFrame.__getitem__
3862
- as opposed to Series.__getitem__
3863
3859
"""
3864
3860
assert kind in ["loc" , "getitem" ], kind
3865
3861
@@ -3882,42 +3878,6 @@ def is_int(v):
3882
3878
3883
3879
if kind == "getitem" :
3884
3880
# called from the getitem slicers, validate that we are in fact integers
3885
- if self .is_integer ():
3886
- if is_frame :
3887
- # unambiguously positional, no deprecation
3888
- pass
3889
- elif start is None and stop is None :
3890
- # label-based vs positional is irrelevant
3891
- pass
3892
- elif isinstance (self , ABCRangeIndex ) and self ._range == range (
3893
- len (self )
3894
- ):
3895
- # In this case there is no difference between label-based
3896
- # and positional, so nothing will change.
3897
- pass
3898
- elif (
3899
- self .dtype .kind in ["i" , "u" ]
3900
- and self ._is_strictly_monotonic_increasing
3901
- and len (self ) > 0
3902
- and self [0 ] == 0
3903
- and self [- 1 ] == len (self ) - 1
3904
- ):
3905
- # We are range-like, e.g. created with Index(np.arange(N))
3906
- pass
3907
- elif not is_index_slice :
3908
- # we're going to raise, so don't bother warning, e.g.
3909
- # test_integer_positional_indexing
3910
- pass
3911
- else :
3912
- warnings .warn (
3913
- "The behavior of `series[i:j]` with an integer-dtype index "
3914
- "is deprecated. In a future version, this will be treated "
3915
- "as *label-based* indexing, consistent with e.g. `series[i]` "
3916
- "lookups. To retain the old behavior, use `series.iloc[i:j]`. "
3917
- "To get the future behavior, use `series.loc[i:j]`." ,
3918
- FutureWarning ,
3919
- stacklevel = find_stack_level (),
3920
- )
3921
3881
if self .is_integer () or is_index_slice :
3922
3882
# Note: these checks are redundant if we know is_index_slice
3923
3883
self ._validate_indexer ("slice" , key .start , "getitem" )
0 commit comments