You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ENH: overflow-safe astype for datetime64/timedelta64 unit conversion #16352
Activity
seberg commentedon May 22, 2020
No, we should raise it. It is a bit clumsy to raise errors from within the casting machinery currently, I think that is pretty much the only reason...
EDIT: There could be a point of just returning NaT, although not really better IMO.
jbrockmendel commentedon May 22, 2020
No idea how to be helpful on that front, but here are links to the relevant pandas code that may be upstream-able:
https://github.com/pandas-dev/pandas/blob/master/pandas/_libs/tslibs/conversion.pyx#L155
https://github.com/pandas-dev/pandas/blob/master/pandas/_libs/tslibs/np_datetime.pyx#L95
https://github.com/pandas-dev/pandas/blob/master/pandas/_libs/tslibs/src/datetime/np_datetime.c#L250
jbrockmendel commentedon Jun 17, 2020
In addition to astype, it'd be nice if addition/subtraction were overflow-safe
jbrockmendel commentedon Mar 23, 2022
Just implemented a version of this in pandas-dev/pandas#46478 that I'm hoping we can upstream to numpy somehow.
TST: add targeted tests for numpygh-16352 and numpygh-22346