Repository navigation
fix: preserve NumPy datetime formatting (issue #251) - #474
Open
chiragjangiir wants to merge 1 commit into
Open
chiragjangiir wants to merge 1 commit into
chiragjangiir wants to merge 1 commit into
Conversation
Exclude NumPy datetime and timedelta values from numeric detection so nanosecond timestamps and zero-dimensional temporal arrays are rendered as text rather than scientific-notation floats. Add regression coverage for scalar and array inputs, multiple datetime resolutions, and mixed numeric tables. Fixes astanin#251.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #251 by preventing NumPy datetime and timedelta values from being incorrectly classified as numeric values during table formatting.
Problem
NumPy nanosecond-resolution timestamps can be converted to floats. This causes values such as
np.datetime64("2022-10-05", "ns")to be rendered as scientific notation (for example,1.66493e+18) instead of as readable datetime strings.Implementation
dtype.kind.DecimalandFraction.Regression coverage
Tests cover:
Tests
git diff --check: passed.These tests were run locally before publication.
Related work
This change addresses the maintainer's previously stated request for regression coverage on the existing issue. PR #252 is related; this PR provides additional edge-case coverage. The maintainer can decide how best to consolidate the contributions.