Skip to content

Commit f38b4cb

Browse files
victorjorisvandenbossche
victor
authored andcommitted
Added debug info to exceptions.
1 parent 654a0ea commit f38b4cb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pandas/_libs/tslibs/timedeltas.pyx

+5-2
Original file line numberDiff line numberDiff line change
@@ -1019,15 +1019,18 @@ class Timedelta(_Timedelta):
10191019
value = parse_iso_format_string(value)
10201020
else:
10211021
try:
1022+
orig_value = value
10221023
value = float(value)
10231024
except ValueError:
10241025
if unit is not None:
1025-
raise ValueError("Unit cannot be defined for strings other than pure integer/floats.")
1026+
raise ValueError("Unit cannot be defined for strings other than pure integer/floats."
1027+
" Value: {} Unit: {}".format(value, unit))
10261028
value = parse_timedelta_string(value)
10271029
value = np.timedelta64(value)
10281030
else:
10291031
if unit is None:
1030-
raise ValueError("Cannot convert float string without unit.")
1032+
raise ValueError("Cannot convert float string without unit."
1033+
" Value: {} Type: {}".format(orig_value, type(orig_value)))
10311034
value = convert_to_timedelta64(value, unit)
10321035
elif PyDelta_Check(value):
10331036
value = convert_to_timedelta64(value, 'ns')

0 commit comments

Comments
 (0)