Skip to content

Commit 28ffc98

Browse files
victorjorisvandenbossche
victor
authored andcommitted
Raise when defining units in string and constructor.
1 parent 93602ac commit 28ffc98

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
@@ -1021,6 +1021,8 @@ class Timedelta(_Timedelta):
10211021
try:
10221022
value = float(value)
10231023
except ValueError:
1024+
if unit is not None:
1025+
raise ValueError("Unit cannot be defined for strings other than pure integer/floats.")
10241026
value = parse_timedelta_string(value)
10251027
value = np.timedelta64(value)
10261028
else:

0 commit comments

Comments
 (0)