3737from pandas .core .index import (Index , MultiIndex , _ensure_index ,
3838 InvalidIndexError , RangeIndex )
3939import pandas .core .indexing as indexing
40- from pandas .core .indexing import maybe_convert_indices
4140from pandas .core .indexes .datetimes import DatetimeIndex
4241from pandas .core .indexes .period import PeriodIndex , Period
4342from pandas .core .internals import BlockManager
@@ -2510,8 +2509,7 @@ def _iget_item_cache(self, item):
25102509 if ax .is_unique :
25112510 lower = self ._get_item_cache (ax [item ])
25122511 else :
2513- lower = self ._take (item , axis = self ._info_axis_number ,
2514- convert = True )
2512+ lower = self ._take (item , axis = self ._info_axis_number )
25152513 return lower
25162514
25172515 def _box_item_values (self , key , values ):
@@ -2765,11 +2763,6 @@ def __delitem__(self, key):
27652763 axis : int, default 0
27662764 The axis on which to select elements. "0" means that we are
27672765 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.
27732766 is_copy : bool, default True
27742767 Whether to return a copy of the original object or not.
27752768
@@ -2785,12 +2778,9 @@ def __delitem__(self, key):
27852778 """
27862779
27872780 @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 ):
27892782 self ._consolidate_inplace ()
27902783
2791- if convert :
2792- indices = maybe_convert_indices (indices , len (self ._get_axis (axis )))
2793-
27942784 new_data = self ._data .take (indices ,
27952785 axis = self ._get_block_manager_axis (axis ),
27962786 verify = True )
@@ -2893,11 +2883,9 @@ def take(self, indices, axis=0, convert=None, is_copy=True, **kwargs):
28932883 msg = ("The 'convert' parameter is deprecated "
28942884 "and will be removed in a future version." )
28952885 warnings .warn (msg , FutureWarning , stacklevel = 2 )
2896- else :
2897- convert = True
28982886
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 )
29012889
29022890 def xs (self , key , axis = 0 , level = None , drop_level = True ):
29032891 """
@@ -2998,9 +2986,9 @@ def xs(self, key, axis=0, level=None, drop_level=True):
29982986 if isinstance (loc , np .ndarray ):
29992987 if loc .dtype == np .bool_ :
30002988 inds , = loc .nonzero ()
3001- return self ._take (inds , axis = axis , convert = False )
2989+ return self ._take (inds , axis = axis )
30022990 else :
3003- return self ._take (loc , axis = axis , convert = True )
2991+ return self ._take (loc , axis = axis )
30042992
30052993 if not is_scalar (loc ):
30062994 new_index = self .index [loc ]
@@ -6784,7 +6772,7 @@ def at_time(self, time, asof=False):
67846772 """
67856773 try :
67866774 indexer = self .index .indexer_at_time (time , asof = asof )
6787- return self ._take (indexer , convert = False )
6775+ return self ._take (indexer )
67886776 except AttributeError :
67896777 raise TypeError ('Index must be DatetimeIndex' )
67906778
@@ -6808,7 +6796,7 @@ def between_time(self, start_time, end_time, include_start=True,
68086796 indexer = self .index .indexer_between_time (
68096797 start_time , end_time , include_start = include_start ,
68106798 include_end = include_end )
6811- return self ._take (indexer , convert = False )
6799+ return self ._take (indexer )
68126800 except AttributeError :
68136801 raise TypeError ('Index must be DatetimeIndex' )
68146802
0 commit comments