Skip to content

Conversation

jbrockmendel
Copy link
Member

Some overlap with #48901, #48889

@mroeschke mroeschke added Timedelta Timedelta data type Non-Nano datetime64/timedelta64 with non-nanosecond resolution labels Oct 3, 2022
raise NotImplementedError
return _broadcast_floordiv_td64(self.value, other, _floordiv)
# TODO: could suppress
# RuntimeWarning: invalid value encountered in floor_divide
Copy link
Member

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

times.view(np.int64), dtype=np.float64 # type: ignore[union-attr]
)
_halflife = float(Timedelta(halflife).value)
# TODO: generalize to non-nano?
Copy link
Member

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

@jbrockmendel
Copy link
Member Author

#48961 (green except for the usual timeout) should cut a lot off the diff here

@mroeschke mroeschke added this to the 1.6 milestone Oct 7, 2022
@mroeschke mroeschke merged commit 5620f0e into pandas-dev:main Oct 7, 2022
@mroeschke
Copy link
Member

Thanks @jbrockmendel. If #48910 (comment) needs addressing in the future that would be great

@jbrockmendel jbrockmendel deleted the nano-tdelta-constructor branch October 7, 2022 17:30
@mroeschke mroeschke modified the milestones: 1.6, 2.0 Oct 13, 2022
noatamir pushed a commit to noatamir/pandas that referenced this pull request Nov 9, 2022
* BUG: Timedelta.__new__

* remove assertion

* GH refs

* API: Timedelta(td64_obj) retain resolution

* revert extraneous

* remove debugging variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Non-Nano datetime64/timedelta64 with non-nanosecond resolution Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants