Skip to content Skip to sidebar Skip to footer

Pandas Change Timezone For Forex Dataframe

How do we change timezone in Pandas DataFrame? I wrote some simple code to read 1min EURUSD data (DateTime/Open/High/Low/Close/Vol). The sample data is in EST timezone, I need to c

Solution 1:

You should use:

df = df.tz_localize(pytz.timezone('US/Eastern'))
df = df.tz_convert(pytz.timezone('UTC'))

since tz_localize is not an in-place operation, but instead returns a new DataFrame.

Post a Comment for "Pandas Change Timezone For Forex Dataframe"