I am trying to convert a timestamp's timezone to UTC, using the following code:
s = pd.to_datetime(pd.Series(['2018-10-28 01:30:00',
'2018-10-28 02:00:00',
'2018-10-28 02:30:00',
'2018-10-28 02:00:00',
'2018-10-28 02:30:00',
'2018-10-28 03:00:00',
'2018-10-28 03:30:00']))
df = pd.DataFrame(s)
df = df.tz_localize(pytz.timezone('US/Eastern')).tz_convert(pytz.timezone('UTC'))
I am getting this error:
TypeError: index is not a valid DatetimeIndex or PeriodIndex