BUG/ENH: cleanup for Timedelta arithmetic by shoyer · Pull Request #8884 · pandas-dev/pandas (original) (raw)
Fixes #8813
Fixes #5963
Fixes #5436
If the other argument has a dtype attribute, I assume that it is ndarray-like
and convert the Timedelta into a np.timedelta64 object. Alternatively, we
could just return NotImplemented and let the other type handle it, but this
has the bonus of making Timedelta compatible with ndarrays.
I also added a Timedelta.to_timedelta64() method to the public API. I
couldn't find a listing for Timedelta in the API docs -- we should probably
add that, right?
Next up would be a similar treatment for Timestamp.
CC @immerrr