Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST: add test for mixed dtypes of df col index #47382 #55720

Merged
merged 3 commits into from
Oct 30, 2023

Conversation

mliu08
Copy link
Contributor

@mliu08 mliu08 commented Oct 27, 2023

Modified the code snippet reproducing the error into a test under tests/frame/test_arithmetic.py.

df2 = DataFrame(columns=list("abc"), data=0.0, index=[0])
df1.columns = df2.columns.astype("string")
df3 = df1 + df2
assert df3.columns.dtype == "object"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you construct an expected DataFrame result and use tm.assert_frame_equal(result, expected)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course! Just committed that modification.

@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label Oct 27, 2023
@mroeschke mroeschke added this to the 2.2 milestone Oct 30, 2023
@mroeschke mroeschke merged commit 1d20b87 into pandas-dev:main Oct 30, 2023
33 checks passed
@mroeschke
Copy link
Member

Thanks @mliu08

@mliu08 mliu08 deleted the mixed-col-dtype-test branch October 31, 2023 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mixed dtypes of column index for data frames raises en error
2 participants