Skip to content

Conversation

AbhishekChaudharii
Copy link
Contributor

@AbhishekChaudharii AbhishekChaudharii commented Nov 20, 2024

result = df.pivot_table(
index="x", columns="y", values="age", aggfunc="mean", dropna=dropna
)
expected_dtype = "float64" if dtype == "int64" else "Float64"
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 put this in the parametrize instead?

@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label Nov 20, 2024
@mroeschke mroeschke added this to the 3.0 milestone Nov 21, 2024
@mroeschke mroeschke merged commit f363721 into pandas-dev:main Nov 21, 2024
51 checks passed
@mroeschke
Copy link
Member

Thanks @AbhishekChaudharii

@AbhishekChaudharii
Copy link
Contributor Author

Happy to help!

KevsterAmp pushed a commit to KevsterAmp/pandas that referenced this pull request Mar 12, 2025
…pandas-dev#60374)

* added tests for int64

* pre-commit changes

* used pytest.mark.parametrize for expected_dtype
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.

BUG: pivot_table downcasting dtypes even if not necessary

2 participants