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