-
Hi Ibis Users / Team, I have a very simple
Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There are a couple mistakes in your example:
There's also a bunch of unnecessary timedelta -> float conversion and list creation. You can do all that with numpy. Finally, the solution to your actual problem is to cast to an interval with desired units. Here's a cleaned up script that shows how to achieve what you want: import numpy as np
import pandas as pd
from ibis.interactive import *
td_list = np.random.randint(5000, 30000, 60) / 10_000
timestamps = pd.date_range(start="2021-01-01 00:00:00", periods=60, freq="180s")
tbl = ibis.memtable({"timestamp": timestamps, "offset_s": td_list})
res = tbl.mutate(tsagg=_.timestamp + (_.offset_s * 1e6).cast("interval('us')"))
print(res) Running that with
|
Beta Was this translation helpful? Give feedback.
There are a couple mistakes in your example:
_
from IbisThere's also a bunch of unnecessary timedelta -> float conversion and list creation. You can do all that with numpy.
Finally, the solution to your actual problem is to cast to an interval with desired units.
Here's a cleaned up script that shows how to achieve what you want: