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

ENH/BUG: infer reso in array_strptime #55805

Merged
merged 3 commits into from
Nov 3, 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.

tolerance = np.timedelta64(1, "ms")

assert res.dtype == "M8[us]"
assert abs(res[0] - now) < tolerance
Copy link
Member

Choose a reason for hiding this comment

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

I would be OK skipping the comparison to a separate "now" to potentially avoid near-miss occasional failures. I think at least passing "today" and "now" through array_strptime and seeing if us is return is good enough

Copy link
Member Author

Choose a reason for hiding this comment

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

would you be happier with a bigger tolerance? I can imagine regressions here that cause this to miss by a huge amount, hard to imagine regressions that miss by a small amount

Copy link
Member

Choose a reason for hiding this comment

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

Yeah a larger tolerance would give me more peace.

@mroeschke mroeschke added the Non-Nano datetime64/timedelta64 with non-nanosecond resolution label Nov 3, 2023
@mroeschke mroeschke added this to the 2.2 milestone Nov 3, 2023
@mroeschke mroeschke merged commit 3fd3756 into pandas-dev:main Nov 3, 2023
33 of 34 checks passed
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the ref-today-now branch November 3, 2023 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Non-Nano datetime64/timedelta64 with non-nanosecond resolution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants