File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -633,11 +633,11 @@ def test_index_type_coercion(self, indexer):
633
633
634
634
def test_setitem_one_element_list (self ):
635
635
# GH#52825
636
- texts = ["abc " ]
637
- languages = ["en " ]
638
- df = DataFrame (columns = ["text " , "language " ])
639
- df .loc [:, "text " ] = texts
640
- df .loc [:, "language " ] = languages
636
+ x_values = ["x_value " ]
637
+ y_values = ["y_values " ]
638
+ df = DataFrame (columns = ["x " , "y " ])
639
+ df .loc [:, "x " ] = x_values
640
+ df .loc [:, "y " ] = y_values
641
641
assert df .size == 2
642
642
643
643
Original file line number Diff line number Diff line change @@ -614,18 +614,15 @@ def test_loc_setitem_consistency_single_row(self):
614
614
615
615
def test_loc_setitem_consistency_empty (self ):
616
616
# empty (essentially noops)
617
- # before the enforcement of #45333 in 2.0, the loc.setitem here would
618
- # change the dtype of df.x to int64
619
617
expected = DataFrame (columns = ["x" , "y" ])
618
+ expected ["x" ] = expected ["x" ].astype (np .int64 )
620
619
df = DataFrame (columns = ["x" , "y" ])
621
620
with tm .assert_produces_warning (None ):
622
621
df .loc [:, "x" ] = 1
623
622
tm .assert_frame_equal (df , expected )
624
623
625
- # setting with setitem swaps in a new array, so changes the dtype
626
624
df = DataFrame (columns = ["x" , "y" ])
627
625
df ["x" ] = 1
628
- expected ["x" ] = expected ["x" ].astype (np .int64 )
629
626
tm .assert_frame_equal (df , expected )
630
627
631
628
def test_loc_setitem_consistency_slice_column_len (self ):
You can’t perform that action at this time.
0 commit comments