Suppose we have a pandas dataframe that have tow columns, one contains timestamps which are in GMT timezone but that is not known by the data and another column that contains timezones as follows
df = pd.DataFrame({'Time': [2016-02-16 13:59:12, 2015-07-22 15:07:06], 'Time_zone': ['Asia/Bangkok', 'America/Mexico_City']})
i want to convert the timestamps in the first column into local time using the timestamp in the second column and store that into a new column named 'local_time'
I tried the following
import datetime
import pytz
df['Time'].apply(lambda x: x.tz_localize('GMT'))
df['local_time'] = df['Time'].apply(lambda x: x.astimezone(pytz.timezone(df['Time_zone'].apply(lambda x: x))))
but it is giving the follwing error
'Series' object has no attribute 'upper'
any help is very much appreciated