to_pd_timestamp
to_pd_timestamp
converts a Java date-time to a pandas.Timestamp
.
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_timestamp(dt: Union[None, Instant, ZonedDateTime]) -> pandas.Timestamp
Parameters
Parameter | Type | Description |
---|---|---|
dt | Union[None, Instant, ZonedDateTime] | A Java date-time to convert to a |
Returns
Returns a pandas.Timestamp
.
Examples
from deephaven.time import dh_now, to_pd_timestamp
instant = dh_now()
pd_ts = to_pd_timestamp(instant)
print(pd_ts, type(pd_ts))
from deephaven.time import dh_now, to_pd_timestamp, to_j_zdt
zdt = to_j_zdt("2024-11-04T12:22:04 ET")
pd_ts = to_pd_timestamp(zdt)
print(pd_ts, type(pd_ts))