@@ -716,34 +716,26 @@ def test_loc_setitem_frame_with_reindex(self):
716
716
expected = DataFrame ({"A" : ser })
717
717
tm .assert_frame_equal (df , expected )
718
718
719
- def test_loc_setitem_frame_with_reindex_mixed (self , using_copy_on_write ):
719
+ def test_loc_setitem_frame_with_reindex_mixed (self ):
720
720
# GH#40480
721
721
df = DataFrame (index = [3 , 5 , 4 ], columns = ["A" , "B" ], dtype = float )
722
722
df ["B" ] = "string"
723
723
msg = "will attempt to set the values inplace instead"
724
724
with tm .assert_produces_warning (FutureWarning , match = msg ):
725
725
df .loc [[4 , 3 , 5 ], "A" ] = np .array ([1 , 2 , 3 ], dtype = "int64" )
726
- ser = Series ([2 , 3 , 1 ], index = [3 , 5 , 4 ], dtype = float )
727
- if not using_copy_on_write :
728
- # For default BlockManager case, this takes the "split" path,
729
- # which still overwrites the column
730
- ser = Series ([2 , 3 , 1 ], index = [3 , 5 , 4 ], dtype = "int64" )
726
+ ser = Series ([2 , 3 , 1 ], index = [3 , 5 , 4 ], dtype = "int64" )
731
727
expected = DataFrame ({"A" : ser })
732
728
expected ["B" ] = "string"
733
729
tm .assert_frame_equal (df , expected )
734
730
735
- def test_loc_setitem_frame_with_inverted_slice (self , using_copy_on_write ):
731
+ def test_loc_setitem_frame_with_inverted_slice (self ):
736
732
# GH#40480
737
733
df = DataFrame (index = [1 , 2 , 3 ], columns = ["A" , "B" ], dtype = float )
738
734
df ["B" ] = "string"
739
735
msg = "will attempt to set the values inplace instead"
740
736
with tm .assert_produces_warning (FutureWarning , match = msg ):
741
737
df .loc [slice (3 , 0 , - 1 ), "A" ] = np .array ([1 , 2 , 3 ], dtype = "int64" )
742
- expected = DataFrame ({"A" : [3.0 , 2.0 , 1.0 ], "B" : "string" }, index = [1 , 2 , 3 ])
743
- if not using_copy_on_write :
744
- # For default BlockManager case, this takes the "split" path,
745
- # which still overwrites the column
746
- expected ["A" ] = expected ["A" ].astype ("int64" )
738
+ expected = DataFrame ({"A" : [3 , 2 , 1 ], "B" : "string" }, index = [1 , 2 , 3 ])
747
739
tm .assert_frame_equal (df , expected )
748
740
749
741
def test_loc_setitem_empty_frame (self ):
0 commit comments