Set timezone based on other column #11004
-
I've tried to look at the docs (especially the temporal ones) as well as the issues and discussions here on GitHub but can't seem to find an answer. I'd like set the timezone of a column of timestamps (ts) based on values in another column (zone). import ibis
t = ibis.memtable(
{
"ts": ["2000-01-01", "2000-01-01T12:00"],
"zone": ["America/New_York", "Europe/Berlin"],
}
).cast({"ts": "timestamp"}) I know that cast can be used for an entire column, but just for a single fixed timezone. Does anyone know of a good way to do that? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
If you're okay with the results being in a single timezone, which is the only possibility with all the backends that Ibis supports, then you can use a scalar builtin UDF:
|
Beta Was this translation helpful? Give feedback.
If you're okay with the results being in a single timezone, which is the only possibility with all the backends that Ibis supports, then you can use a scalar builtin UDF: