You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "randolf-scholz (via GitHub)" <gi...@apache.org> on 2024/04/22 19:27:42 UTC

Re: [I] [C++] `duration` add missing kernels [arrow]

randolf-scholz commented on issue #39233:
URL: https://github.com/apache/arrow/issues/39233#issuecomment-2070756267

   There are 2 more operations supported by `numpy` that are missing in the list above:
   
   1. `multiply(duration, double/float) -> duration`
   2. `divide(duration, double/float) -> duration`
   
   In both cases, `numpy` performs automatic rounding towards the specified time resolution:
   
   ```python
   import numpy as np
   td = np.timedelta64(5, "D")
   print(td * 1.5)  # 7 days
   print(td / 1.5)  # 3 days
   ```
   
   Especially the multiply kernel would be very useful, because it is the inverse operation to the `divide(duration, duration) -> double` kernel, which is needed if one wants to reverse pre-processing transformations.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org