Skip to content

fix(xlsx): preserve full float precision instead of scientific notation - #2717

Open
Wali Reheman (wali-reheman) wants to merge 1 commit into
microsoft:mainfrom
wali-reheman:fix/upstream-xlsx-float-precision
Open

Wali Reheman (wali-reheman) wants to merge 1 commit into
microsoft:mainfrom
wali-reheman:fix/upstream-xlsx-float-precision

Conversation

@wali-reheman

Copy link
Copy Markdown

Fixes #2664.

pandas DataFrame.to_html defaults to 6-digit scientific notation, which loses precision for values like 123456789.123. This PR passes float_format=lambda x: str(x) to both to_html() calls in the XLSX and XLS converters, preserving the full Python round-trip string representation.

  • Both XlsxConverter and XlsConverter updated
  • Regression test added (test_float_precision_preserved)

@wali-reheman

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@wali-reheman
Wali Reheman (wali-reheman) force-pushed the fix/upstream-xlsx-float-precision branch 2 times, most recently from 49f445e to 1900506 Compare October 22, 2026 13:30
Pass float_format=lambda x: str(x) to DataFrame.to_html() calls in both
XLSX and XLS converters so that float values like 123456789.123 are
rendered as-is instead of being truncated to 1.234568e+05.

Refs: microsoft#2664
@wali-reheman
Wali Reheman (wali-reheman) force-pushed the fix/upstream-xlsx-float-precision branch from 1900506 to 0d4e02c Compare October 22, 2026 23:13
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.

1 participant