-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
API/DEPR: re-instate timedelta[non-unit] conversions as a no-op #19225
Comments
timedelta[non-unit]
conversions as a no-op
My first reaction was: and why not having the actual timedelta resolution? As we support this when doing But, this is actually maybe a bug / also not consistent, as in theory we only support 'ns' resolution:
and for datetime it is interpreted correctly as well but then converted to ns:
On the actual issue, I have to think a bit further about it, but agree that the float result is very strange |
[4] is fixed by PR #19224 (I don't know if we had an issue about that before) [7] is also fixed by that (its not a regression per-se because I broke it in a prior PR in master/0.23). but note that the examples are not relevant to THIS issue. We are taking something that is already a dateimelike type and astyping it. |
I wanted to open a separate issue for that (as the timedelta[s] series should not be created, as once you do operations with it you get bugs by it sometimes being interpreted as ns and sometimes as s), but we already have #12425 were this is also discussed. |
[7] that I showed was already correct no? So what is exactly fixed/changed there? |
Pushing. |
i think we're settled on a long-term solution of eventually supporting |
Yes I think we want to support this as an EA instead of simply no-oping. Closing but happy to reopen if I misunderstood |
when I originally added first class timedelta support I allowed
.astype('m8[unit]')
to return a float, except if unit==ns. IOW it was de-facto the same a dividing byTimedelta(1, unit=unit)
note that for [5], however we just return a timedelta64[ns] (which happens to be the underlying data representation).
#19224 fixes construction of non-ns (and preserves the astype freq conversions. I think that this is confusing to the user and we should revert this and have a
m8[unit]
just work the same as it does forM8[unit]
namely that you get back a timedelta dtype (and not a float), that is the sameSo [3] would be the same as [5]
We do this for datetime types now
sure this is slightly convenient but a bit confusing.
I would propose that we provide a deprecation warning and change it in the next version.
The text was updated successfully, but these errors were encountered: