We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent afadca4 commit 6865973Copy full SHA for 6865973
pandas/_libs/tslib.pyx
@@ -595,7 +595,7 @@ cpdef array_to_datetime(
595
continue
596
elif is_raise:
597
raise ValueError(
598
- f"time data {val} doesn't match format specified"
+ f"time data \"{val}\" at position {i} doesn't match format specified"
599
)
600
return values, tz_out
601
@@ -607,11 +607,11 @@ cpdef array_to_datetime(
607
# to check if all arguments have the same tzinfo
608
tz = py_dt.utcoffset()
609
610
- except (ValueError, OverflowError):
+ except (ValueError, OverflowError) as err:
611
if is_coerce:
612
iresult[i] = NPY_NAT
613
614
- raise TypeError("invalid string coercion to datetime")
+ raise type(err)(f"invalid string coercion to datetime for \"{val}\" at position {i}")
615
616
if tz is not None:
617
seen_datetime_offset = True
0 commit comments