-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
FIX: Scalar timedelta NaT results raise #7661
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
Conversation
Currently, coercion of scalar results from `float` to `timedelta64[ns]` passes through `int`, which raises when attempting to coerce `NaN` to `NaT`. To reproduce: ```python import pandas as pd import numpy as np pd.Series([np.timedelta64('NaT')]).sum() # TypeError: reduction operation 'sum' not allowed for this dtype ```
needs tests (put in e.g. |
Test coverage for ops on `NaT` values is a little better. The SciPy functions for which operations on `datetime64` and `timedelta64` make sense could be added, but to my knowledge SciPy will currently choke on these anyway.
Oh, the problem is that test_nanops.py only covers NaN and ignores NaT. Hrm. Any bets on how much breakage this change is going to reveal? |
It looks like |
you don't handle m8 like that |
I don't understand what you mean by that. I will see if I can get back to it sometime over the weekend. |
Note that `print(np.array([pd.tslib.iNaT], dtype='m8[ns]'))` does not display correctly, but its behavior is consistent with being Not-A-Time.
OK, clearly I need to wait until I have time to really read this and figure out what's going on. |
have a look at |
@ischwabacher status? |
Sorry, hectic time at home. I will try to make time for this soon. |
closing in favor of #8268 this is already fixed in master with Timedelta refactor |
Currently, coercion of scalar results from
float
totimedelta64[ns]
passes throughint
, which raises when attempting to coerceNaN
toNaT
.To reproduce: