File tree 2 files changed +8
-3
lines changed
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -3718,6 +3718,10 @@ def _getitem_bool_array(self, key):
3718
3718
# check_bool_indexer will throw exception if Series key cannot
3719
3719
# be reindexed to match DataFrame rows
3720
3720
key = check_bool_indexer (self .index , key )
3721
+
3722
+ if key .all ():
3723
+ return self .copy (deep = None )
3724
+
3721
3725
indexer = key .nonzero ()[0 ]
3722
3726
return self ._take_with_is_copy (indexer , axis = 0 )
3723
3727
@@ -6418,7 +6422,7 @@ def drop_duplicates(
6418
6422
4 Indomie pack 5.0
6419
6423
"""
6420
6424
if self .empty :
6421
- return self .copy ()
6425
+ return self .copy (deep = None )
6422
6426
6423
6427
inplace = validate_bool_kwarg (inplace , "inplace" )
6424
6428
ignore_index = validate_bool_kwarg (ignore_index , "ignore_index" )
Original file line number Diff line number Diff line change @@ -369,10 +369,11 @@ def test_head_tail(method, using_copy_on_write):
369
369
tm .assert_frame_equal (df , df_orig )
370
370
371
371
372
- def test_assign (using_copy_on_write ):
372
+ @pytest .mark .parametrize ("method" , ["assign" , "drop_duplicates" ])
373
+ def test_assign_drop_duplicates (using_copy_on_write , method ):
373
374
df = DataFrame ({"a" : [1 , 2 , 3 ]})
374
375
df_orig = df .copy ()
375
- df2 = df . assign ()
376
+ df2 = getattr ( df , method ) ()
376
377
df2 ._mgr ._verify_integrity ()
377
378
378
379
if using_copy_on_write :
You can’t perform that action at this time.
0 commit comments