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)

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

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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