Skip to content

Commit 50e4268

Browse files
author
victor
committed
Raise when defining units in string and constructor.
1 parent 9a776c4 commit 50e4268

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
@@ -1121,6 +1121,8 @@ class Timedelta(_Timedelta):
11211121
try:
11221122
value = float(value)
11231123
except ValueError:
1124+
if unit is not None:
1125+
raise ValueError("Unit cannot be defined for strings other than pure integer/floats.")
11241126
value = parse_timedelta_string(value)
11251127
value = np.timedelta64(value)
11261128
else:

0 commit comments

Comments
 (0)