Skip to content

BUG: Bug fix for implicit upcast to float64 for large series (more than 1000000 rows) #62077

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

allecole
Copy link

@allecole allecole commented Aug 8, 2025

PR Requirements

Issue Description

Performing binary operations on larger Series with dtype == 'float32' leads to unexpected upcasts to float64.
Above example prints float32 float64.
Using to_numpy() on the series before addition inhibits the implicit upcast.

Expected Behavior

I expect above snippet to print float32 float32.

Bug Fix

Changed scalar conversion logic for NumPy floating scalars to avoid automatic conversion to Python float. Now returns a scalar of the original NumPy dtype to preserve type and prevent unintended dtype upcasts.

@allecole
Copy link
Author

allecole commented Aug 8, 2025

pre-commit.ci autofix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Implicit upcast to float64 for large series (more than 1000000 rows)
1 participant