to_np_timedelta64
to_np_timedelta64
converts a Java time duration to a numpy.timedelta64
.
danger
Avoid deephaven.time
functions in query strings. Because deephaven.time
provides functions that convert between Python and Java types, every call crosses the Python-Java boundary, which slows performance. For more information, see:
Syntax
to_np_timedelta64(dt: Union[None, Duration, Period]) -> numpy.timedelta64
Parameters
Parameter | Type | Description |
---|---|---|
dt | Union[None, Duration, Period] | A Java time duration to convert to a |
Returns
Returns a numpy.timedelta64
.
Examples
from deephaven.time import to_j_duration, to_np_timedelta64
duration = to_j_duration("PT42M")
np_td = to_np_timedelta64(duration)
print(np_td, type(np_td))
from deephaven.time import dh_now, to_np_timedelta64, to_j_period, to_j_duration
period = to_j_period("P2Y")
np_td = to_np_timedelta64(period)
print(np_td)