Skip to content

timezone operations #9273

Answered by cpcloud
kbzsl asked this question in Q&A
Discussion options

You must be logged in to vote

The operations you're asking for can all be done with the .cast method in Ibis.

In [9]: from ibis.interactive import *

In [10]: naive = ibis.timestamp('2010-01-01 00:01:02.333')

In [11]: less_naive = naive.cast("timestamp('UTC')")  # add a timezone to a naive timestamp

In [12]: less_naive
Out[12]:
┌────────────────────────────────────────────────────────┐
│ Timestamp('2010-01-01 00:01:02.333000+0000', tz='UTC') │
└────────────────────────────────────────────────────────┘

In [13]: less_naive.cast("timestamp('America/New_York')")  # with a specific timezone
Out[13]:
┌─────────────────────────────────────────────────────────────────────┐
│ Timestamp('2009-12-31 19:01:02.333000-0500', tz=…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by cpcloud
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants