-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
API: Series(mixed_datetime_and_ints, dtype="M8[ns]") vs DatetimeIndex(same) mismatch #49037
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
Comments
I would be +1 to raising (given the exception message notes how to cast) |
not sure what you have in mind. if all of our functions raise, do we tell them to do it manually? |
Namely I could see users wanting "I am providing mixed datetimes & ints and I want the ints to be interpreted as ns and the output reso to be ns" But it's a fair point that the resolution may be hard to always suggest if this is raised internally |
cc @jreback |
I'm thinking that if we allow this at all- which I'm of mixed mind on- it should be in to_datetime, which I would expect to be the most aggressive about "cast to datetimes no matter what" |
I personally don't like the behaviour of casting such mixed type values much (I was actually going to say on the PR that I would rather disallow it), but there might also be some consistency reasons to allow it (or at least other cases to consider as well). A mixture of timestamps and strings casts as well, and in this case also DatetimeIndex allows it:
We should probably also be talking about casting (
Yes, agreed that if we would disallow, |
These should either all cast or all raise. I'd be OK either way, leaning towards all-raise.
The text was updated successfully, but these errors were encountered: