Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
simplify
  • Loading branch information
MarcoGorelli committed Jan 5, 2023
commit a334a8412d23a63eff6562001a0eb638228b42a7
6 changes: 2 additions & 4 deletions pandas/_libs/tslib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -614,16 +614,14 @@ cpdef array_to_datetime(
else:
raise TypeError(f"{type(val)} is not convertible to datetime")

except (OutOfBoundsDatetime,) as ex:
except OutOfBoundsDatetime as ex:
ex.args = (f"{ex}, at position {i}",)
if is_coerce:
iresult[i] = NPY_NAT
continue
elif is_raise:
raise
if isinstance(ex, OutOfBoundsDatetime):
return ignore_errors_out_of_bounds_fallback(values), tz_out
return values, None
return ignore_errors_out_of_bounds_fallback(values), tz_out

except (TypeError, OverflowError, ValueError) as ex:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currenly, OutOfBoundsDatetime is in a separate block. That's because of #50587

If it's OK, I'll address that in a separate PR, to not make the diff too big here

ex.args = (f"{ex}, at position {i}",)
Expand Down