Skip to content

Conversation

michiel-de-muynck
Copy link
Contributor

This is the same bug fix code as PR #50174, which went stale and had no tests. The author of that PR is no longer responding. This PR adds tests and release notes.

@michiel-de-muynck michiel-de-muynck changed the title BUG: Fix to_excel storing decimals as strings insteae of numbers (issue #49598) BUG: Fix to_excel storing decimals as strings instead of numbers (issue #49598) Nov 7, 2024
@mroeschke mroeschke added the IO Excel read_excel, to_excel label Nov 7, 2024
@mroeschke mroeschke added this to the 3.0 milestone Nov 7, 2024
@mroeschke mroeschke merged commit feaa963 into pandas-dev:main Nov 7, 2024
54 checks passed
@mroeschke
Copy link
Member

Thanks @michiel-de-muynck

@LorenzoMorelli
Copy link

LorenzoMorelli commented Dec 11, 2024

Hi, thanks for your work!
When I export a dataframe to my PostgreSQL database with to_sql(...) using if_exists='replace', decimal.Decimal values are stored as TEXT instead of DECIMAL. Does this patch also fix this issue?

@michiel-de-muynck
Copy link
Contributor Author

Hi Lorenzo, this only affects Excel, not PostgreSQL.

@asishm
Copy link
Member

asishm commented Dec 18, 2024

@mroeschke this is milestoned 3.0 but the whatsnew entry is in 2.3. does that need to be addressed (or backported)?

@mroeschke
Copy link
Member

Oops the whatsnew entry should be moved to v3.0.0.rst. Could you open another PR to do that @michiel-de-muynck?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

IO Excel read_excel, to_excel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Dataframe.to_excel treats decimal.Decimal as string instead of numeric type, the data in the Excel cell is formatted as a string, not a number

4 participants