@@ -3263,7 +3263,7 @@ def _clear_item_cache(self) -> None:
3263
3263
# Indexing Methods
3264
3264
3265
3265
def take (
3266
- self : FrameOrSeries , indices , axis = 0 , is_copy : bool_t = True , ** kwargs
3266
+ self : FrameOrSeries , indices , axis = 0 , is_copy : bool_t = None , ** kwargs
3267
3267
) -> FrameOrSeries :
3268
3268
"""
3269
3269
Return the elements in the given *positional* indices along an axis.
@@ -3281,6 +3281,8 @@ def take(
3281
3281
selecting rows, ``1`` means that we are selecting columns.
3282
3282
is_copy : bool, default True
3283
3283
Whether to return a copy of the original object or not.
3284
+
3285
+ .. deprecated:: 1.0.0
3284
3286
**kwargs
3285
3287
For compatibility with :meth:`numpy.take`. Has no effect on the
3286
3288
output.
@@ -3349,9 +3351,17 @@ class max_speed
3349
3351
result = self ._constructor (new_data ).__finalize__ (self )
3350
3352
3351
3353
# Maybe set copy if we didn't actually change the index.
3352
- if is_copy :
3354
+ if is_copy is not None :
3355
+ warnings .warn (
3356
+ "is_copy is deprecated and will be removed in a future version. "
3357
+ "take will always return a copy in the future." ,
3358
+ FutureWarning ,
3359
+ stacklevel = 2 ,
3360
+ )
3353
3361
if not result ._get_axis (axis ).equals (self ._get_axis (axis )):
3354
3362
result ._set_is_copy (self )
3363
+ else :
3364
+ is_copy = True
3355
3365
3356
3366
return result
3357
3367
@@ -5002,7 +5012,7 @@ def sample(
5002
5012
)
5003
5013
5004
5014
locs = rs .choice (axis_length , size = n , replace = replace , p = weights )
5005
- return self .take (locs , axis = axis , is_copy = False )
5015
+ return self .take (locs , axis = axis )
5006
5016
5007
5017
_shared_docs [
5008
5018
"pipe"
@@ -6999,7 +7009,7 @@ def asof(self, where, subset=None):
6999
7009
7000
7010
# mask the missing
7001
7011
missing = locs == - 1
7002
- data = self .take (locs , is_copy = False )
7012
+ data = self .take (locs )
7003
7013
data .index = where
7004
7014
data .loc [missing ] = np .nan
7005
7015
return data if is_list else data .iloc [- 1 ]
0 commit comments