Skip to content

Commit ece009e

Browse files
BUG: fixed OutOfBoundsDatetime exception when errors=coerce pandas-dev#45319
1 parent 37e6239 commit ece009e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pandas/core/tools/datetimes.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,11 @@ def _maybe_cache(
227227
unique_dates = unique(arg)
228228
if len(unique_dates) < len(arg):
229229
cache_dates = convert_listlike(unique_dates, format)
230-
cache_array = Series(cache_dates, index=unique_dates)
230+
# GH#45319
231+
try:
232+
cache_array = Series(cache_dates, index=unique_dates)
233+
except OutOfBoundsDatetime:
234+
pass
231235
# GH#39882 and GH#35888 in case of None and NaT we get duplicates
232236
if not cache_array.index.is_unique:
233237
cache_array = cache_array[~cache_array.index.duplicated()]

0 commit comments

Comments
 (0)