Skip to content

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:

Raises:

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)