-
-
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
DEPR: Timedelta.delta #46476
DEPR: Timedelta.delta #46476
Conversation
@@ -1014,6 +1014,12 @@ cdef class _Timedelta(timedelta): | |||
>>> td.delta | |||
42 | |||
""" | |||
# Deprecated GH#46476 | |||
warnings.warn( | |||
"Timedelta.delta is deprecated and will be removed in a future version.", |
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.
Probably good to mention the alternative in the message?
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.
i'm not sure there is a good alternative. since the meaning of .value may change as we get non-nano working
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.
In [96]: td / pd.Timedelta('1ns')
Out[96]: 123456546.0
In [97]: td / pd.Timedelta('1s')
Out[97]: 0.123456546
you can say the alt is to convert a float like this which puts it in the specified units.
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.
well neither of those is the same behavior they're getting now.
Telling the user how to "keep the same behavior" really depends on what they are trying to do:
- using .value directly is good if they just want to get at the guts of the object
- or .view("i8") if for some reason they want the same thing but slower
- if they really care about getting a number of nanoseconds then they need obj.to_timedelta64("ns").view("i8") (which risks overflowing in a non-nano world)
I think we deprecate like this and wait to see if anyone complains.
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.It's redundant and promises to become confusing once we have non-nano td64.