rok commented on issue #37192:
URL: https://github.com/apache/arrow/issues/37192#issuecomment-1680331785
Thanks for reporting this!
Could you say more about your intended use of this? If you're looking to get
number of units since epoch you could just run:
```python
import pyarrow as pa
arr = pa.array([0, 10E17], pa.timestamp("ns"))
arr.cast(pa.int64())
<pyarrow.lib.Int64Array object at 0x7fea336b9ea0>
[
0,
1000000000000000000
]
```
If you're looking to round your time to multiples of units I'd suggest
looking at temporal rounding functions:
```python
import pyarrow.compute as pc
pc.floor_temporal(arr, multiple=1, unit="second")
<pyarrow.lib.TimestampArray object at 0x7fea33be2740>
[
1970-01-01 00:00:00.000000000,
2001-09-09 01:46:40.000000000
]
```
More here: https://arrow.apache.org/docs/cpp/compute.html#conversions
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]