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

POC/ENH: Timedelta min/max/resolution support non-nano #47641

Merged
merged 1 commit into from
Jul 8, 2022

Conversation

jbrockmendel
Copy link
Member

No description provided.

@mroeschke mroeschke added Timedelta Timedelta data type Non-Nano datetime64/timedelta64 with non-nanosecond resolution labels Jul 8, 2022
@mroeschke mroeschke added this to the 1.5 milestone Jul 8, 2022
@mroeschke mroeschke merged commit 64ae0fe into pandas-dev:main Jul 8, 2022
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@mroeschke
Copy link
Member

I dont this this is directly related, but I think this hypothesis failure may be a near neighbor failure to the non-nano code you've been in the weeds with

022-07-08T19:09:27.0107944Z ================================== FAILURES ===================================
2022-07-08T19:09:27.0108768Z _______________ TestTimestampUnaryOps.test_round_sanity[round] ________________
2022-07-08T19:09:27.0188497Z [gw0] win32 -- Python 3.8.13 C:\Users\runneradmin\micromamba\envs\test\python.exe
2022-07-08T19:09:27.0188803Z 
2022-07-08T19:09:27.0192971Z >   return Timedelta._from_value_and_reso(res_value, self._reso)
2022-07-08T19:09:27.0193292Z 
2022-07-08T19:09:27.0193473Z pandas\_libs\tslibs\timestamps.pyx:521: 
2022-07-08T19:09:27.0193820Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2022-07-08T19:09:27.0194006Z 
2022-07-08T19:09:27.0194394Z >   def _from_value_and_reso(cls, int64_t value, NPY_DATETIMEUNIT reso):
2022-07-08T19:09:27.0198386Z E   OverflowError: int too big to convert
2022-07-08T19:09:27.0198647Z 
2022-07-08T19:09:27.0198846Z pandas\_libs\tslibs\timedeltas.pyx:1521: OverflowError
2022-07-08T19:09:27.0199075Z 
2022-07-08T19:09:27.0199272Z The above exception was the direct cause of the following exception:
2022-07-08T19:09:27.0199508Z 
2022-07-08T19:09:27.0199966Z self = <pandas.tests.scalar.timestamp.test_unary_ops.TestTimestampUnaryOps object at 0x000001C0E0CFFFA0>
2022-07-08T19:09:27.0204415Z method = <cyfunction Timestamp.round at 0x000001C0AE3BA520>
2022-07-08T19:09:27.0204681Z 
2022-07-08T19:09:27.0205195Z     @given(val=st.integers(iNaT + 1, lib.i8max))
2022-07-08T19:09:27.0205516Z >   @pytest.mark.parametrize(
2022-07-08T19:09:27.0206044Z         "method", [Timestamp.round, Timestamp.floor, Timestamp.ceil]
2022-07-08T19:09:27.0210300Z     )
2022-07-08T19:09:27.0210514Z 
2022-07-08T19:09:27.0210884Z pandas\tests\scalar\timestamp\test_unary_ops.py:301: 
2022-07-08T19:09:27.0211247Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2022-07-08T19:09:27.0211998Z pandas\tests\scalar\timestamp\test_unary_ops.py:351: in test_round_sanity
2022-07-08T19:09:27.0216046Z     assert np.abs((res - ts).value) < nanos
2022-07-08T19:09:27.0216452Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2022-07-08T19:09:27.0216633Z 
2022-07-08T19:09:27.0216772Z >   raise OutOfBoundsDatetime(
2022-07-08T19:09:27.0221599Z E   pandas._libs.tslibs.np_datetime.OutOfBoundsDatetime: Result is too large for pandas.Timedelta. Convert inputs to datetime.datetime with 'Timestamp.to_pydatetime()' before subtracting.
2022-07-08T19:09:27.0222080Z 
2022-07-08T19:09:27.0227140Z pandas\_libs\tslibs\timestamps.pyx:525: OutOfBoundsDatetime
2022-07-08T19:09:27.0227891Z --------------------------------- Hypothesis ----------------------------------
2022-07-08T19:09:27.0228323Z Falsifying example: test_round_sanity(
2022-07-08T19:09:27.0228807Z     val=9223329600000000000,
2022-07-08T19:09:27.0229343Z     self=<pandas.tests.scalar.timestamp.test_unary_ops.TestTimestampUnaryOps at 0x1c0e0cfffa0>,
2022-07-08T19:09:27.0233440Z     method=<cyfunction Timestamp.round at 0x000001C0AE3BA520>,
2022-07-08T19:09:27.0233738Z )
2022-07-08T19:09:27.0233865Z 
2022-07-08T19:09:27.0238472Z You can reproduce this example by temporarily adding @reproduce_failure('6.47.1', b'AAAAf//ZZ2ZYgAA=') as a decorator on your test case

@jbrockmendel jbrockmendel deleted the nano-minmax branch July 11, 2022 17:06
yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
)

ENH: Timedelta min/max/resolution support non-nano
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 Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants