-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Converting None values with pandas.to_datetime is unpredictable #23055
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
Personally not sure if there's a history to this but maybe @jbrockmendel knows |
I'm not aware of any reason for this. Its also inconsistent with a couple of other construction methods:
@dinya a PR to fix this would be welcome. |
|
@WillAyd I was giving this a try, and I think this may be why people haven't ever changed it: changing the returned
I think this |
@pambot I saw some questions come through via email but don't think they made it to the GitHub UI (believe they were having some issues when you posted). I know one of your questions was around how a DTI should behave when an |
@WillAyd Oh yeah, sorry for the confusion - I think I posted that just before I discovered the source of the bug (that triggered before any tests even ran), namely that a line had to be changed to |
you can can use isna on a scalar value to check |
Sorry for messy PR. Please review! |
Why does
pandas
convertNone
values in the different ways forto_datetime
(unpredictable) andto_numeric
(predictable)?returns
due to https://github.com/pandas-dev/pandas/blob/v0.23.4/pandas/core/tools/datetimes.py#L382
Why not
pd.to_datetime(None) is pd.NaT
by design?See also original post at stackoverflow.
The text was updated successfully, but these errors were encountered: