Skip to content

featurebyte.to_timedelta

to_timedelta(
series: Series,
unit: Literal["day", "hour", "minute", "second", "millisecond", "microsecond"]
) -> Series

Description

Construct a timedelta Series that can be used to increment a datetime Series.

Parameters

  • series: Series
    Series representing the amount of time unit

  • unit: Literal["day", "hour", "minute", "second", "millisecond", "microsecond"]
    A supported unit in str

Returns

  • Series

Raises

  • ValueError
    if input Series is not of INT type

Examples

>>> items_view = catalog.get_view("INVOICEITEMS")
>>> items_view["DAYS_SINCE_LAST_INVOICE"] = to_timedelta(
...   items_view["DAYS_SINCE_LAST_INVOICE"], "days"
... )