Skip to content

Commit 63f8c3b

Browse files
author
victor
committed
Added debug info to exceptions.
1 parent 4295276 commit 63f8c3b

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

0 commit comments

Comments
 (0)