Skip to content

Commit 437f534

Browse files
author
victor
committed
Added debug info to exceptions.
1 parent 2718cef commit 437f534

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
@@ -1120,15 +1120,18 @@ class Timedelta(_Timedelta):
11201120
value = parse_iso_format_string(value)
11211121
else:
11221122
try:
1123+
orig_value = value
11231124
value = float(value)
11241125
except ValueError:
11251126
if unit is not None:
1126-
raise ValueError("Unit cannot be defined for strings other than pure integer/floats.")
1127+
raise ValueError("Unit cannot be defined for strings other than pure integer/floats."
1128+
" Value: {} Unit: {}".format(value, unit))
11271129
value = parse_timedelta_string(value)
11281130
value = np.timedelta64(value)
11291131
else:
11301132
if unit is None:
1131-
raise ValueError("Cannot convert float string without unit.")
1133+
raise ValueError("Cannot convert float string without unit."
1134+
" Value: {} Type: {}".format(orig_value, type(orig_value)))
11321135
value = convert_to_timedelta64(value, unit)
11331136
elif PyDelta_Check(value):
11341137
value = convert_to_timedelta64(value, 'ns')

0 commit comments

Comments
 (0)