Here is my data structure:
ids = 1
timezones = ['America/Los_Angeles', 'Europe/Paris', 'America/New_York']
utc_time = ['2020-09-03 19:36:18.534', '2020-09-03 19:36:18.534', '2020-09-03 19:36:18.534']
df = pd.DataFrame({'id':ids,
'timezone':timezones,
'utc_time':utc_time})
print(df)
id timezone utc_time
0 1 America/Los_Angeles 2020-09-03 19:36:18.534
1 1 Europe/Paris 2020-09-03 19:36:18.534
2 1 America/New_York 2020-09-03 19:36:18.534
How can I generate a new column added to this dataframe that converts the UTC time to the local time based on the timezone? I have tried a few solutions I've found but haven't been able to get them to work in this format whereby the timezone changes for each row.
Thanks in advance.