Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test timedelta64 dtype arrays with various date/time units #3567

Merged
merged 1 commit into from
Nov 6, 2024

Conversation

seisman
Copy link
Member

@seisman seisman commented Oct 31, 2024

np.timedelta64 is internally stored as 64-bit integers. So any date/time units listed at https://numpy.org/doc/stable/reference/arrays.datetime.html#datetime-units are supported.

This PR improves the existing test (added in #2884) by testing time units like "ns", "ps", "fs", and "as".

Patches #2884.

@seisman seisman added maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog needs review This PR has higher priority and needs review. labels Oct 31, 2024
@seisman seisman added this to the 0.14.0 milestone Oct 31, 2024
@seisman seisman requested a review from weiji14 October 31, 2024 06:07
"""
for unit in ["Y", "M", "W", "D", "h", "m", "s", "ms", "μs"]:
for unit in ["Y", "M", "W", "D", "h", "m", "s", "ms", "us", "ns", "ps", "fs", "as"]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this test was limited to just "μs" because GMT supports up to microsecond for datetime as you mentioned at #464 (comment). But for timedelta, I guess it doesn't matter if we are using nanosecond or lower since it is just a linear scale.

@seisman seisman merged commit 0169b9d into main Nov 6, 2024
18 checks passed
@seisman seisman deleted the tests/timedelta64 branch November 6, 2024 02:31
@seisman seisman removed the needs review This PR has higher priority and needs review. label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants