-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
API: preserve reso in Timelta(td64_obj) #48910
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: preserve reso in Timelta(td64_obj) #48910
Conversation
raise NotImplementedError | ||
return _broadcast_floordiv_td64(self.value, other, _floordiv) | ||
# TODO: could suppress | ||
# RuntimeWarning: invalid value encountered in floor_divide |
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.
This would be great (especially if it comes from a pandas routine) so we can turn on -W:::pandas in the future
@@ -134,7 +134,8 @@ def _calculate_deltas( | |||
_times = np.asarray( | |||
times.view(np.int64), dtype=np.float64 # type: ignore[union-attr] | |||
) | |||
_halflife = float(Timedelta(halflife).value) | |||
# TODO: generalize to non-nano? |
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.
Yeah this currently assumes np.diff(_times)
and _halflife
are both ns
, so I think as long as they are both brought to the higher of the resolution it should be fine
#48961 (green except for the usual timeout) should cut a lot off the diff here |
Thanks @jbrockmendel. If #48910 (comment) needs addressing in the future that would be great |
* BUG: Timedelta.__new__ * remove assertion * GH refs * API: Timedelta(td64_obj) retain resolution * revert extraneous * remove debugging variable
Some overlap with #48901, #48889