-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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/DEPR: Timestamp/Timedelta resolution #29910
Conversation
@@ -804,9 +804,13 @@ def test_resolution_string(self): | |||
def test_resolution_deprecated(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename this test to just test_resolution
pandas/_libs/tslibs/timedeltas.pyx
Outdated
@@ -1602,3 +1552,4 @@ cdef _broadcast_floordiv_td64(int64_t value, object other, | |||
# resolution in ns | |||
Timedelta.min = Timedelta(np.iinfo(np.int64).min + 1) | |||
Timedelta.max = Timedelta(np.iinfo(np.int64).max) | |||
Timedelta.resolution = Timedelta(nanoseconds=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think a newline is needed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm ex @mroeschke comments
updated+green |
Thanks @jbrockmendel |
* BUG/DEPR: Timestamp/Timedelta resolution * GH ref
* BUG/DEPR: Timestamp/Timedelta resolution * GH ref
Timedelta.resolution used to return a string, but that was deprecated in 0.25.0. Enforce that deprecation to return Timedelta(nanoseconds=1), mirroring the stdlib timedelta.resolution behavior.
Timestamp.resolution correctly mirrors datetime.resolution by returning Timedelta(nanoseconds=1), but it is a property whereas for the stdlib it is a class attribute. This PR makes it a class attribute for Timestamp.