@@ -3355,7 +3355,9 @@ def _clear_item_cache(self):
3355
3355
# ----------------------------------------------------------------------
3356
3356
# Indexing Methods
3357
3357
3358
- def take (self , indices , axis = 0 , is_copy = True , ** kwargs ):
3358
+ # def take(self, indices, axis=0, is_copy=True, **kwargs):
3359
+
3360
+ def take (self , indices , axis = 0 , is_copy = None , ** kwargs ):
3359
3361
"""
3360
3362
Return the elements in the given *positional* indices along an axis.
3361
3363
@@ -3372,6 +3374,8 @@ def take(self, indices, axis=0, is_copy=True, **kwargs):
3372
3374
selecting rows, ``1`` means that we are selecting columns.
3373
3375
is_copy : bool, default True
3374
3376
Whether to return a copy of the original object or not.
3377
+
3378
+ .. deprecated:: 0.25.2
3375
3379
**kwargs
3376
3380
For compatibility with :meth:`numpy.take`. Has no effect on the
3377
3381
output.
@@ -3430,6 +3434,14 @@ class max_speed
3430
3434
1 monkey mammal NaN
3431
3435
3 lion mammal 80.5
3432
3436
"""
3437
+ if is_copy is not None :
3438
+ warnings .warn (
3439
+ "is_copy is deprecated and will be removed in a future version" ,
3440
+ FutureWarning ,
3441
+ stacklevel = 2 ,
3442
+ )
3443
+ is_copy = True
3444
+
3433
3445
nv .validate_take (tuple (), kwargs )
3434
3446
3435
3447
self ._consolidate_inplace ()
@@ -5014,7 +5026,7 @@ def sample(
5014
5026
)
5015
5027
5016
5028
locs = rs .choice (axis_length , size = n , replace = replace , p = weights )
5017
- return self .take (locs , axis = axis , is_copy = False )
5029
+ return self .take (locs , axis = axis )
5018
5030
5019
5031
_shared_docs [
5020
5032
"pipe"
@@ -7255,7 +7267,7 @@ def asof(self, where, subset=None):
7255
7267
7256
7268
# mask the missing
7257
7269
missing = locs == - 1
7258
- data = self .take (locs , is_copy = False )
7270
+ data = self .take (locs )
7259
7271
data .index = where
7260
7272
data .loc [missing ] = np .nan
7261
7273
return data if is_list else data .iloc [- 1 ]
0 commit comments