Converting None values with pandas.to_datetime is unpredictable · Issue #23055 · pandas-dev/pandas (original) (raw)
Why does pandas
convert None
values in the different ways for to_datetime
(unpredictable) and to_numeric
(predictable)?
import pandas as pd
VALUE = None
print(pd.to_datetime(VALUE)) print(pd.to_numeric(VALUE))
print(pd.version)
returns
None
nan
0.23.4
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.