pandas to_datetime errors='ignore' deprecated (tested)

FutureWarning: errors='ignore' is deprecated and will raise in a future version: on pandas 3.1.0 it now raises ValueError: errors must be one of 'raise', or 'coerce'. We ran the same code on pandas 2.3.3 and 3.1.0 and tested the replacements, including pd.to_numeric.

1. errors="ignore" on pandas 2 and pandas 3

import warnings
import pandas as pd
warnings.simplefilter("always")

s = pd.Series(["2026-10-23", "not a date"])
try:
    print(pd.to_datetime(s, errors="ignore").tolist())
except ValueError as e:
    print("ValueError:", e)
try:
    pd.to_datetime(s)
except ValueError as e:
    print("ValueError:", str(e).splitlines()[0])
print(pd.to_datetime(s, errors="coerce").tolist())

Output with pandas 2.3.3:

/w/b1.py:7: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_datetime without passing `errors` and catch exceptions explicitly instead
  print(pd.to_datetime(s, errors="ignore").tolist())
['2026-10-23', 'not a date']
ValueError: time data "not a date" doesn't match format "%Y-%m-%d", at position 1. You might want to try:
[Timestamp('2026-10-23 00:00:00'), NaT]

Output with pandas 3.1.0:

ValueError: errors must be one of 'raise', or 'coerce'.
ValueError: time data "not a date" doesn't match format "%Y-%m-%d". You might want to try:
[Timestamp('2026-10-23 00:00:00'), NaT]

pandas 2.3.3 warns that errors="ignore" is deprecated; pandas 3 removed it and raises ValueError: errors must be one of 'raise', or 'coerce'. "Ignore" never meant "skip bad values": if any value failed, it returned the whole input unchanged, so the good date stayed a string too (first output line on pandas 2).

2. Replacements

import pandas as pd

s = pd.Series(["2026-10-23", "not a date"])
def to_dt_or_keep(x):                    # what errors="ignore" used to do
    try:
        return pd.to_datetime(x)
    except (ValueError, TypeError):
        return x
print(to_dt_or_keep(s).tolist())

parsed = pd.to_datetime(s, errors="coerce")   # or: keep per-value fallbacks
print(parsed.where(parsed.notna(), s).tolist())
print(s[parsed.isna()].tolist())              # see which values failed

Output (identical on pandas 2.3.3 and 3.1.0, no warnings):

['2026-10-23', 'not a date']
[Timestamp('2026-10-23 00:00:00'), 'not a date']
['not a date']

To keep the old all-or-nothing behaviour exactly, wrap the call in try/except as the warning text recommends. Usually what you want is errors="coerce": bad values become NaT and the good ones are parsed. s[parsed.isna()] lists the values that failed so you can fix the format (for example with format= or dayfirst=True). Mixing Timestamps and strings in one column, as in the second output line, gives an object column, so only do that for display.

3. Same change in pd.to_numeric

import warnings
import pandas as pd
warnings.simplefilter("always")

s = pd.Series(["1", "x"])
try:
    print(pd.to_numeric(s, errors="ignore").tolist())
except ValueError as e:
    print("ValueError:", e)
print(pd.to_numeric(s, errors="coerce").tolist())

Output with pandas 2.3.3:

/w/b3.py:7: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead
  print(pd.to_numeric(s, errors="ignore").tolist())
['1', 'x']
[1.0, nan]

Output with pandas 3.1.0:

ValueError: invalid error value specified
[1.0, nan]

to_numeric(errors="ignore") went the same way, with a vaguer pandas 3 message: invalid error value specified. Use errors="coerce" or try/except here too.

Related: all pandas 3 breaking changes · FutureWarning: concat with empty or all-NA entries · SettingWithCopyWarning · Error tokenizing data.

Frequently asked questions

What replaces errors='ignore' in pd.to_datetime?

errors='coerce' (bad values become NaT), or call to_datetime without errors inside try/except to keep the old return-input-unchanged behaviour.

Does pandas 3 still accept errors='ignore'?

No. to_datetime raises ValueError: errors must be one of 'raise', or 'coerce'. to_numeric raises ValueError: invalid error value specified.

Did errors='ignore' skip only the bad values?

No. If any value failed to parse it returned the entire input unchanged, so valid dates stayed strings too.

Written with AI assistance. Measured on 2026-10-23 in the python:3-alpine Docker image (Python 3.14) with pandas 2.3.3 and pandas 3.1.0. Each block was run verbatim on both versions with warnings.simplefilter("always") and the output pasted unedited. PlainHeaders is our extension; Python and pandas are free.