Last active
February 17, 2017 08:31
-
-
Save RenSys/ecee5f3845ea7aa64dd5e0c5f0003c07 to your computer and use it in GitHub Desktop.
Pandas - Convert Timezones
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
df = pd.DataFrame(data = [1,2,3,4,5], index = pd.date_range("7:00", "9:00", freq="30min", tz = 'UTC')) | |
# convert UTC Timezone to Australia Perth | |
df.index = df.index.tz_convert('Australia/Perth') | |
# Remove TZ information from the datetime stamp, this is useful when exporting to Excel | |
df.index = df.index.tz_localize(None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment