Pandas version checks
-
[X] I have checked that this issue has not already been reported.
-
[X] I have confirmed this bug exists on the latest version of pandas.
-
[X] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
In [4]: to_datetime([np.datetime64('9999-01-01')], errors='ignore')[0]
Out[4]: datetime.date(9999, 1, 1)
In [5]: to_datetime([np.datetime64('9999-01-01')], errors='ignore', format='%Y-%m-%d')[0]
Out[5]: numpy.datetime64('9999-01-01')
Issue Description
The docs say that with errors='ignore'
, the input will be returned, but that's not happening here
Expected Behavior
Just return the input
Installed Versions
Comment From: jbrockmendel
The docs say that with errors='ignore', the input will be returned, but that's not happening here
ive been thinking about this recently w/r/t to the two helpers in tslib.pyx. I figure "ignore" means either
a) "return the input unchanged", in which case we should consider deprecating it and telling users to do try/except themselves
b) pd.to_datetime(obj, errors="ignore")
on error falls back to essentiallyobj.apply(try_to_datetime_ignore_on_error)
. Which I have no objection to, but it's not quite what we do in the fallback-helpers.
Comment From: MarcoGorelli
yeah my thinking is 1. fixup this inconsistency and simplify the codebase 2. deprecate
In all my Kaggle notebook scrapes I've never seen errors='ignore'
anyway, the only place I've ever seen it is internally in the csv parser. We're just creating more work for ourselves with this one IMO
Comment From: jbrockmendel
do you want to try changing this in 2.0? or deprecate in 2.x?
Comment From: MarcoGorelli
yeah sure, I'll try to get a PR to fix the inconsistency and simplify the logic into 2.0 and then we can deprecate 'ignore'
completely in 2.x