-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
BUG: coercion of non-M8[ns] in datetime ops #7996
Comments
I am not fully following here. Isn't this just a limitation of numpy's string parsing? Numpy only parses ISO timestrings, so But in any case |
no I think it's just broken in numpy np.datetime64('2013-01-01') make this dtype of M8[D] but I don't think it allows astype to M8ns |
it still IS possible though I think you just have to get the value and figure it out based in the dtype (which is where pandas can handle it - if the astype worked then it would be easy) |
This looks like astype to |
hmm maybe doesn't work in 1.7 I think |
that was in 1.7.1 (and 1.8.1) |
try exactly how I have it (the format) |
That is indeed bullshit output, but that is because numpy does not support non-iso string parsing, not because of the
|
That seems a bug in numpy, that is does not raise:
it does raise when there is also an hour and not only date. Or is there a reason a date-only would allow more flexible string parsing? |
ahh ok but we still don't handle this input correctly (a non ns numpy datetime input) |
yes, so it a legitimate issue :-) (only the comment about |
@jreback Figured out the strange behaviour of numpy :-) It is interpreting
But it apparantly does not give an out-of-range date error when astyping to ns range. |
For copy/pasting, the OP has a typo in line AFAICT the |
Slightly different kind of wrong when using a DatetimeIndex instead of Series:
|
Yes, it is:
|
I'm about to submit a PR that fixes this. It works for Series but still fails for DataFrame. |
Hello, I am having issues with the datetime64, can anyone help me here?
|
This fails as the datetime64 is not converted properly (because numpy datetime ops suck)
e.g.
np.datetime64('20130101').astype('M8[ns]')
is a bug, no?The text was updated successfully, but these errors were encountered: