Skip to content

Commit cf5bc0a

Browse files
author
MarcoGorelli
committed
BUG: to_datetime raising on invalid offsets with errors=coerce and infer_datetime_format
1 parent e493323 commit cf5bc0a

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

doc/source/whatsnew/v1.6.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ Categorical
162162
Datetimelike
163163
^^^^^^^^^^^^
164164
- Bug in :func:`pandas.infer_freq`, raising ``TypeError`` when inferred on :class:`RangeIndex` (:issue:`47084`)
165+
- Bug in :func:`to_datetime` was raising on invalid offsets with ``errors='coerce'`` and ``infer_datetime_format=True`` (:issue:`48633`)
165166
-
166167

167168
Timedelta

pandas/_libs/tslibs/parsing.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ def format_is_iso(f: str) -> bint:
943943
return False
944944

945945

946-
def guess_datetime_format(dt_str, bint dayfirst=False):
946+
def guess_datetime_format(dt_str: str, bint dayfirst=False) -> str | None:
947947
"""
948948
Guess the datetime format of a given datetime string.
949949

0 commit comments

Comments
 (0)