Skip to main content
Version: Python

to_pd_timedelta

to_pd_timedelta converts a Java Duration to a pandas.Timedelta.

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_pd_timedelta(dt: Union[None, Duration]) -> pandas.Timedelta

Parameters

ParameterTypeDescription
dtUnion[None, Duration]

A Java Duration to convert to a pandas.Timedelta. If None is provided, None is returned.

Returns

Returns a pandas.Timedelta.

Examples

from deephaven.time import to_j_duration, to_pd_timedelta

duration = to_j_duration("PT42M")

pd_td = to_pd_timedelta(duration)

print(pd_td, type(pd_td))