Skip to content

Commit f042800

Browse files
Add test for multi-column dtype assignment (#47323)
* add test * add blank line * fix
1 parent 25749d2 commit f042800

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/tests/dtypes/test_dtypes.py

+12
Original file line numberDiff line numberDiff line change
@@ -1140,3 +1140,15 @@ def test_compare_complex_dtypes():
11401140

11411141
with pytest.raises(TypeError, match=msg):
11421142
df.lt(df.astype(object))
1143+
1144+
1145+
def test_multi_column_dtype_assignment():
1146+
# GH #27583
1147+
df = pd.DataFrame({"a": [0.0], "b": 0.0})
1148+
expected = pd.DataFrame({"a": [0], "b": 0})
1149+
1150+
df[["a", "b"]] = 0
1151+
tm.assert_frame_equal(df, expected)
1152+
1153+
df["b"] = 0
1154+
tm.assert_frame_equal(df, expected)

0 commit comments

Comments
 (0)