Skip to content

ENH: Timestamp +- timedeltalike scalar support non-nano #47313

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

Merged
merged 3 commits into from
Jun 13, 2022

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.

@@ -390,20 +387,31 @@ cdef class _Timestamp(ABCTimestamp):
# TODO: no tests get here
other = ensure_td64ns(other)

# TODO: what to do with mismatched resos?
Copy link
Member

Choose a reason for hiding this comment

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

IMO I would raise and only allow this for matching resos

@@ -853,6 +853,29 @@ def test_to_period(self, dt64, ts):
alt = Timestamp(dt64)
assert ts.to_period("D") == alt.to_period("D")

@pytest.mark.parametrize(
"td", [timedelta(days=4), Timedelta(days=4), np.timedelta64(4, "D")]
Copy link
Member

Choose a reason for hiding this comment

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

So in the future Timedelta with a non-nano reso will be tested separately to solidify ts._reso/td._reso semantics?

Copy link
Member Author

Choose a reason for hiding this comment

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

thats the idea, yes

@mroeschke mroeschke added this to the 1.5 milestone Jun 13, 2022
@mroeschke mroeschke added Datetime Datetime data dtype Numeric Operations Arithmetic, Comparison, and Logical operations Timedelta Timedelta data type Non-Nano datetime64/timedelta64 with non-nanosecond resolution labels Jun 13, 2022
@mroeschke mroeschke merged commit b74dc5c into pandas-dev:main Jun 13, 2022
@jbrockmendel jbrockmendel deleted the nano-addsub branch June 13, 2022 19:59
yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
…7313)

* ENH: Timestamp +- timedeltalike scalar support non-nano

* catch and re-raise OverflowError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Non-Nano datetime64/timedelta64 with non-nanosecond resolution Numeric Operations Arithmetic, Comparison, and Logical operations Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants