Skip to content
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

REGR: astype introducing decimals when casting from int with na to string #57489

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

phofl
Copy link
Member

@phofl phofl commented Feb 18, 2024

@phofl phofl added the Dtype Conversions Unexpected or buggy dtype conversions label Feb 18, 2024
@phofl phofl added this to the 2.2.1 milestone Feb 18, 2024
@phofl phofl requested a review from WillAyd as a code owner February 18, 2024 21:05
@@ -759,7 +759,7 @@ cpdef ndarray[object] ensure_string_array(
out = arr.astype(str).astype(object)
out[arr.isna()] = na_value
return out
arr = arr.to_numpy()
arr = arr.to_numpy(dtype=object)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this only be done for certain dtypes? (integer?)

(maybe run the string.py::Construction benchmarks to check impact, as those were added for this code path #37371)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no changes reported

@mroeschke mroeschke merged commit 6ed649d into pandas-dev:main Feb 20, 2024
49 of 51 checks passed
@mroeschke
Copy link
Member

Thanks @phofl

meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Feb 20, 2024
mroeschke pushed a commit that referenced this pull request Feb 20, 2024
… when casting from int with na to string) (#57533)

Backport PR #57489: REGR: astype introducing decimals when casting from int with na to string

Co-authored-by: Patrick Hoefler <61934744+phofl@users.noreply.github.com>
pmhatre1 pushed a commit to pmhatre1/pandas-pmhatre1 that referenced this pull request May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: conversion from Int64 to string introduces decimals in Pandas 2.2.0
3 participants