-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
Increase edge case check strictness when cols_droplevel contains empty values #62527
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
Conversation
| # GH 62518 | ||
| df4 = DataFrame( | ||
| columns=MultiIndex.from_arrays( | ||
| [["a", "a", "z", "z"], pd.Categorical([1, 2, 1, 2])], | ||
| ), | ||
| dtype=object, | ||
| ) | ||
| df4["z"] = df4["z"].astype("int64") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make this a separate test that uses the exact code snippet in the original issue?
| ), | ||
| dtype=object, | ||
| ) | ||
| meta["z"] = meta["z"].astype("int64") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, one more thing. Could you use tm.assert_frame.equal to assert that meta is equal to a new DataFrame that's the result of this casting?
|
Thanks @matiaslindgren |
DataFrame.__setitem__with DataFrame, Categorical level of MultiIndex in pandas 3.x #62518doc/source/whatsnew/vX.X.X.rstfile if fixing a bug or adding a new feature.