-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
BUG: pivot_table downcasting dtypes even if not necessary #47971
Comments
Related: #53521 |
Both cases seem to result now in a float result:
So we could close this issue after adding an explicit test for this. |
take |
Hi @jorisvandenbossche, it seems that this issue is the same as #47477. The test case was also added with the bug fix and while writing the test case and whatsnew @phofl has mentioned #47477 instead of this one(#47971). I think we can close this issue. |
@AbhishekChaudharii - the test added in #47477 is with |
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
with
dropna=True
this returnsint64
dtype, while we getfloat64
withdropna=False
. This happens because we try to downcast if we set dropna, because we drop all nan rows which cast our dtypes to float.But the downcast path is also hit, when we don't have all nan rows and hence the aggregation function returned the correct dtype all along.
Expected Behavior
I think both cases should be consistent if no nans are dropped, e.g. we should not try to downcast.
If we want to do this, we should probably deprecate or changing in 2.0, but not in a minor release
Installed Versions
The text was updated successfully, but these errors were encountered: