Skip to content

Preserve integer precision in mixed numeric DataFrames - #459

Open
loaff123 wants to merge 1 commit into
astanin:masterfrom
loaff123:fix/tabulate-240
Open

loaff123 wants to merge 1 commit into
astanin:masterfrom
loaff123:fix/tabulate-240

Conversation

@loaff123

@loaff123 loaff123 commented Oct 2, 2026 •

Copy link
Copy Markdown

Fixes #240.

A DataFrame containing integer and floating columns can expose a shared floating-point .values matrix. Integers are converted before formatting: intfmt is ignored and values above the exact floating-point range can round, for example 2**53 + 1.

When that matrix has a floating dtype and an integer column is present, read plain row tuples with itertuples(index=False, name=None). Preserve existing index/header handling and column order, including duplicate names, and retain the matrix path for other inputs. Tests cover large signed/unsigned values, indices, column labels, empty dimensions, nullable values, mixed text, and temporal controls. The README documents the bounded numeric-column behavior.

Validation rerun on Windows 11 / Python 3.11.9 / NumPy 2.4.6 / pandas 3.0.6:

  • python -m pytest -q: 413 passed, 1 skipped, including doctests.
  • Ruff 0.15.4 check and format --check: passed.
  • A representative added formatting regression fails against the unchanged upstream base.
  • git diff --check: passed.

Ruff 0.16.10 was also attempted and reported newer lint/README formatting diagnostics; the passing lint run uses the project's declared development minimum, 0.15.4. No source was changed to resolve unrelated tool-version diagnostics.

AI assistance was used to prepare and verify the patch. Archived Linux version-matrix/build/benchmark checks were not rerun here. Numeric categorical/complex inputs and global scalar inference are outside the fix. It is a correctness change with possible fixed overhead on small DataFrames; no new performance claim is made. Submitted for maintainer review and upstream CI.

@loaff123
loaff123 marked this pull request as ready for review October 2, 2026 09:03
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.

Integer DataFrame columns are erroneously converted to float

1 participant