-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
add test to check crosstab supports Float64 formats #50459
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
add test to check crosstab supports Float64 formats #50459
Conversation
df = DataFrame( | ||
{"A": [1, 2, 2, 1], "B": [3, 3, 4, 5], "C": [-1.0, 10.0, 1.0, 10.0]} | ||
) | ||
df = df.astype({"C": "Float64"}) |
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.
Can you avoid the astype and define this as float immediately?
index=[1, 2, "All"], | ||
dtype="Float64", | ||
) | ||
expected.columns = Index([3, 4, 5, "All"], dtype="object", name="B") |
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.
Same here, please define expected in one go
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.
Thank you, @phofl, for your comments. I updated my PR as you suggested.
thx @natmokval |
Thank you, @phofl, for reviewing my PR. |
A new test is added. The test validates
crosstab
behavior withFloat64
. I have checked that the problem occurs whenFloat64
is used together withmargins=True
.The test fails on
1.5.2
and passes onmain
.