pandas Timedelta documentation states that the value
input parameter should be of the following types:
valueTimedelta, timedelta, np.timedelta64, str, or int
However, when I use a floating point number for value
, it seems to work fine. For example:
pd.Timedelta(1.234234, "h")
yields
Timedelta('0 days 01:14:03.242400')
This functionality is said to be based on numpy's timedelta64
which indeed raises an error when passed a floating point argument.
So, is it always safe to use a floating point number for value
with pandas Timedelta
? Is the docstring simply wrong?
source https://stackoverflow.com/questions/72418372/pandas-timedelta-with-float-argument
Comments
Post a Comment