Skip to content

Commit a80ac0a

Browse files
update for 2.3.x
1 parent c3ef550 commit a80ac0a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pandas/tests/frame/indexing/test_coercion.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,24 @@ def test_26395(indexer_al):
115115
FutureWarning, match="Setting an item of incompatible dtype"
116116
):
117117
indexer_al(df)["C", "D"] = 44.5
118-
expected = DataFrame({"D": [0, 0, 44.5]}, index=["A", "B", "C"], dtype=np.float64)
118+
expected = DataFrame(
119+
{"D": [0, 0, 44.5]},
120+
index=["A", "B", "C"],
121+
columns=pd.Index(["D"], dtype=object),
122+
dtype=np.float64,
123+
)
119124
tm.assert_frame_equal(df, expected)
120125

121126
with tm.assert_produces_warning(
122127
FutureWarning, match="Setting an item of incompatible dtype"
123128
):
124129
indexer_al(df)["C", "D"] = "hello"
125-
expected = DataFrame({"D": [0, 0, "hello"]}, index=["A", "B", "C"], dtype=object)
130+
expected = DataFrame(
131+
{"D": [0, 0, "hello"]},
132+
index=["A", "B", "C"],
133+
columns=pd.Index(["D"], dtype=object),
134+
dtype=object,
135+
)
126136
tm.assert_frame_equal(df, expected)
127137

128138

0 commit comments

Comments
 (0)