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

BUG: incorrect OutOfBoundsDatetime with non-nano dtype #55756

Merged
merged 2 commits into from
Oct 30, 2023

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

Big step toward #55564. tznaive analogue to #54620

dtype = "M8[us]"
# NB: the 2500 is interpreted as nanoseconds and rounded *down*
# to 2 microseconds
vals = [ts, "2999-01-02 03:04:05.678910", 2500]
Copy link
Member

Choose a reason for hiding this comment

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

Could we add a doc example/explanation for this edge case (maybe in to_datetime)?

Copy link
Member Author

Choose a reason for hiding this comment

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

to_datetime isn't a great fit bc it doesnt have a dtype keyword. ill have to give some thought to where this might live. would you be OK with punting on that for the moment? this is a blocker for resolution-inference

Copy link
Member

Choose a reason for hiding this comment

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

OK to punt for now. I do think this is a potential non-obvious behavior that users might encounter so would be good to document in the future

@mroeschke mroeschke added Bug Non-Nano datetime64/timedelta64 with non-nanosecond resolution labels Oct 30, 2023
@mroeschke mroeschke added this to the 2.2 milestone Oct 30, 2023
@mroeschke mroeschke merged commit 2d2d67d into pandas-dev:main Oct 30, 2023
39 of 41 checks passed
@jbrockmendel jbrockmendel deleted the bug-dt64-astype branch October 30, 2023 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Non-Nano datetime64/timedelta64 with non-nanosecond resolution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants