Skip to content

[C++][Python] Add multiply/divide kernels for duration and float/double #48003

@randolf-scholz

Description

@randolf-scholz

Describe the enhancement requested

numpy supports multiplying/dividing timedelta values with floats and performs automatic rounding to the current unit, e.g.

>>> import numpy as np
>>> x = np.array([0, 1, 2, 3, 4, 5], dtype="timedelta64[s]")
>>> x * 0.5
array([0, 0, 1, 1, 2, 2], dtype='timedelta64[s]')
>>> x * 1.5
array([0, 1, 3, 4, 6, 7], dtype='timedelta64[s]')

This is very useful for ML applications where one needs to transform timestamps first to durations and then to floats (and back after performing a forecast). It would be very nice if pyarrow supported this as well, so one can directly work with arrow dtypes.

Component(s)

C++

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions