(Not a duplicate question)
In this question, I am using Python3 and Pandas
In my raw dataset, the datetime was in GMT
datetime format: 2017-01-01 00:00:00
I converted the GMT datetime into EST by doing this:
df['Gmt time'] = df['Gmt time'].dt.tz_localize('GMT').dt.tz_convert('America/New_York')
The new datetime now look like this:
2016-12-31 19:00:00-05:00
now when I do:
df['Gmt time'] = pd.DatetimeIndex(df['Gmt time'])
I get this error:
TypeError: [datetime.datetime(2016, 12, 31, 19, 0, tzinfo=tzoffset(None, -18000))
I tried to fix it by doing this:
df['Gmt time'] = pd.DatetimeIndex(df['Gmt time'], tz='EST') to speficy that the datetime is in EST
That is not working. How do I fix it? I need the end 'datetime' to be in EST
datetimehaving an offset value, theDatetimeIndexis not working. I need somehow to remove the offset value or make theDFconsider thedatetimeis correct.