37
37
from pandas .core .index import (Index , MultiIndex , _ensure_index ,
38
38
InvalidIndexError , RangeIndex )
39
39
import pandas .core .indexing as indexing
40
- from pandas .core .indexing import maybe_convert_indices
41
40
from pandas .core .indexes .datetimes import DatetimeIndex
42
41
from pandas .core .indexes .period import PeriodIndex , Period
43
42
from pandas .core .internals import BlockManager
@@ -2510,8 +2509,7 @@ def _iget_item_cache(self, item):
2510
2509
if ax .is_unique :
2511
2510
lower = self ._get_item_cache (ax [item ])
2512
2511
else :
2513
- lower = self ._take (item , axis = self ._info_axis_number ,
2514
- convert = True )
2512
+ lower = self ._take (item , axis = self ._info_axis_number )
2515
2513
return lower
2516
2514
2517
2515
def _box_item_values (self , key , values ):
@@ -2765,11 +2763,6 @@ def __delitem__(self, key):
2765
2763
axis : int, default 0
2766
2764
The axis on which to select elements. "0" means that we are
2767
2765
selecting rows, "1" means that we are selecting columns, etc.
2768
- convert : bool, default True
2769
- Whether to convert negative indices into positive ones.
2770
- For example, ``-1`` would map to the ``len(axis) - 1``.
2771
- The conversions are similar to the behavior of indexing a
2772
- regular Python list.
2773
2766
is_copy : bool, default True
2774
2767
Whether to return a copy of the original object or not.
2775
2768
@@ -2785,12 +2778,9 @@ def __delitem__(self, key):
2785
2778
"""
2786
2779
2787
2780
@Appender (_shared_docs ['_take' ])
2788
- def _take (self , indices , axis = 0 , convert = True , is_copy = True ):
2781
+ def _take (self , indices , axis = 0 , is_copy = True ):
2789
2782
self ._consolidate_inplace ()
2790
2783
2791
- if convert :
2792
- indices = maybe_convert_indices (indices , len (self ._get_axis (axis )))
2793
-
2794
2784
new_data = self ._data .take (indices ,
2795
2785
axis = self ._get_block_manager_axis (axis ),
2796
2786
verify = True )
@@ -2893,11 +2883,9 @@ def take(self, indices, axis=0, convert=None, is_copy=True, **kwargs):
2893
2883
msg = ("The 'convert' parameter is deprecated "
2894
2884
"and will be removed in a future version." )
2895
2885
warnings .warn (msg , FutureWarning , stacklevel = 2 )
2896
- else :
2897
- convert = True
2898
2886
2899
- convert = nv .validate_take (tuple (), kwargs )
2900
- return self ._take (indices , axis = axis , convert = convert , is_copy = is_copy )
2887
+ nv .validate_take (tuple (), kwargs )
2888
+ return self ._take (indices , axis = axis , is_copy = is_copy )
2901
2889
2902
2890
def xs (self , key , axis = 0 , level = None , drop_level = True ):
2903
2891
"""
@@ -2998,9 +2986,9 @@ def xs(self, key, axis=0, level=None, drop_level=True):
2998
2986
if isinstance (loc , np .ndarray ):
2999
2987
if loc .dtype == np .bool_ :
3000
2988
inds , = loc .nonzero ()
3001
- return self ._take (inds , axis = axis , convert = False )
2989
+ return self ._take (inds , axis = axis )
3002
2990
else :
3003
- return self ._take (loc , axis = axis , convert = True )
2991
+ return self ._take (loc , axis = axis )
3004
2992
3005
2993
if not is_scalar (loc ):
3006
2994
new_index = self .index [loc ]
@@ -6784,7 +6772,7 @@ def at_time(self, time, asof=False):
6784
6772
"""
6785
6773
try :
6786
6774
indexer = self .index .indexer_at_time (time , asof = asof )
6787
- return self ._take (indexer , convert = False )
6775
+ return self ._take (indexer )
6788
6776
except AttributeError :
6789
6777
raise TypeError ('Index must be DatetimeIndex' )
6790
6778
@@ -6808,7 +6796,7 @@ def between_time(self, start_time, end_time, include_start=True,
6808
6796
indexer = self .index .indexer_between_time (
6809
6797
start_time , end_time , include_start = include_start ,
6810
6798
include_end = include_end )
6811
- return self ._take (indexer , convert = False )
6799
+ return self ._take (indexer )
6812
6800
except AttributeError :
6813
6801
raise TypeError ('Index must be DatetimeIndex' )
6814
6802
0 commit comments