ToDuration(unit)
Source¶
Bases: TimeFunction
Each number read as a duration in a unit: 1.5 in days gives 36 hours.
The result is a DURATION Array, rounded to the nanosecond. Applies to integers and decimals, not to
booleans. DurationIn does the opposite.
Added in version 0.1.0
Parameters:
-
unit(DurationUnit)The unit of the numbers.
Raises:
-
InvalidTypeErrorWhen a setting is not of the type its annotation names.
-
TimeOverflowError
Examples:
import numdaplot as ndp
nights = ndp.Array.from_list([3, 10])
nights.apply(ndp.ToDuration(unit=ndp.DurationUnit.DAY))
# Array(['3 days 00:00:00', '10 days 00:00:00'], dtype=DURATION)