Skip to content

Commit c25770d

Browse files
author
victor
committed
Raise when defining units in string and constructor.
1 parent b0d595b commit c25770d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pandas/_libs/tslibs/timedeltas.pyx

+2
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,8 @@ class Timedelta(_Timedelta):
11221122
try:
11231123
value = float(value)
11241124
except ValueError:
1125+
if unit is not None:
1126+
raise ValueError("Unit cannot be defined for strings other than pure integer/floats.")
11251127
value = parse_timedelta_string(value)
11261128
value = np.timedelta64(value)
11271129
else:

0 commit comments

Comments
 (0)