Read Microsoft's intraday stock price
Convert naive DatetimeIndex to timezone aware DatetimeIndex using tz_localize
df.tz_localize(tz='US/Eastern')
df
Out[4]:
Price
Date Time
2017-08-17 09:00:00 72.38
2017-08-17 09:15:00 71.00
2017-08-17 09:30:00 71.67
2017-08-17 10:00:00 72.80
2017-08-17 10:30:00 73.00
2017-08-17 11:00:00 72.50
df.index = df.index.tz_localize(tz='US/Eastern')
df.index
DatetimeIndex(['2017-08-17 09:00:00-04:00', '2017-08-17 09:15:00-04:00',
'2017-08-17 09:30:00-04:00', '2017-08-17 10:00:00-04:00',
'2017-08-17 10:30:00-04:00', '2017-08-17 11:00:00-04:00'],
dtype='datetime64[ns, US/Eastern]', name='Date Time', freq=None)
Convert to Berlin time using tz_convert
df = df.tz_convert('Europe/Berlin')
df
Price
Date Time
2017-08-17 15:00:00+02:00 72.38
2017-08-17 15:15:00+02:00 71.00
2017-08-17 15:30:00+02:00 71.67
2017-08-17 16:00:00+02:00 72.80
2017-08-17 16:30:00+02:00 73.00
2017-08-17 17:00:00+02:00 72.50
df.index
DatetimeIndex(['2017-08-17 15:00:00+02:00', '2017-08-17 15:15:00+02:00',
'2017-08-17 15:30:00+02:00', '2017-08-17 16:00:00+02:00',
'2017-08-17 16:30:00+02:00', '2017-08-17 17:00:00+02:00'],
dtype='datetime64[ns, Europe/Berlin]', name='Date Time', freq=None)