Skip to content

Instantly share code, notes, and snippets.

@wesm
Created January 23, 2018 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wesm/56e9acee120b0af60391b54245e03c31 to your computer and use it in GitHub Desktop.
Save wesm/56e9acee120b0af60391b54245e03c31 to your computer and use it in GitHub Desktop.
In [1]: import pandas as pd
In [2]: ts = pd.Timestamp('2000-01-01 00:00:00')
In [3]: ts
Out[3]: Timestamp('2000-01-01 00:00:00')
In [4]: ts.hour
Out[4]: 0
In [5]: ts.value
Out[5]: 946684800000000000
In [6]: ts_nyc = ts.tz_localize('America/New_York')
In [7]: ts_nyc
Out[7]: Timestamp('2000-01-01 00:00:00-0500', tz='America/New_York')
In [8]: ts_nyc.hour
Out[8]: 0
In [9]: ts_nyc.value
Out[9]: 946702800000000000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment