-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
pd.Timedelta.resolution is different from datetime.timedelta.resolution #21344
Comments
I would prefer option 1. Option 2 would commit us (to some extent) to tracking |
(Sorry this was initially posted against the wrong issue): pandas/pandas/_libs/tslibs/timedeltas.pyx Line 797 in 9d61ab5
|
@drewmassey if we move forward with option 1. Then we would:
If we move forward with option 2 then yes it would be a breaking change. I would slightly prefer option 1 as well since it doesn't disrupt the current API. |
Ok I can handle this. Let me get the PR through for issue #21336 to make sure I have the pandas workflow in shape and then I'll submit this one. |
I think we should deprecate the current behavior and eventually change it to match the stdlib. @mroeschke thoughts? |
Agreed that we should match the stdlib. |
Working on this I'm noticing that we also have Timestamp.resolution subtly different from datetime.resolution. On datetime it is a class attribute, whereas on Timestamp it is a property |
Yikes, and pd.NaT.resolution has the datetime behavior |
timedelta.resolution
is documented as:while
pandas.Timedelta.resolution
is doc-string'd as:I think this difference should be addressed by either:
datetime.timedelta
's notion of resolution inTimedelta
(i.e. something that returnsTimedelta(nanoseconds=1)
)Timedelta.resolution
consistent withtimedelta.resolution
and creating a new property for "the lowest resolution" of aTimedelta
instanceThoughts?
xref #21336
The text was updated successfully, but these errors were encountered: