Skip to content

Commit 1d20b87

Browse files
authored
TST: add test for mixed dtypes of df col index #47382 (#55720)
* add test for mixed dtypes of df col index #47382 * modified test to use result and expected dfs
1 parent f7bda17 commit 1d20b87

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/frame/test_arithmetic.py

+10
Original file line numberDiff line numberDiff line change
@@ -2103,3 +2103,13 @@ def test_enum_column_equality():
21032103
expected = Series([True, True, True], name=Cols.col1)
21042104

21052105
tm.assert_series_equal(result, expected)
2106+
2107+
2108+
def test_mixed_col_index_dtype():
2109+
# GH 47382
2110+
df1 = DataFrame(columns=list("abc"), data=1.0, index=[0])
2111+
df2 = DataFrame(columns=list("abc"), data=0.0, index=[0])
2112+
df1.columns = df2.columns.astype("string")
2113+
result = df1 + df2
2114+
expected = DataFrame(columns=list("abc"), data=1.0, index=[0])
2115+
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)