I have two columns of data in a pandas dataframe, UTC timestamp and 'Timezone' for user data. I am trying to create a column for the 'local' timestamp of that user. For example, I have a UTC timestamp:2019-10-27 17:18:31.034
, and a corresponding Timezone as "Timezone:"Asia/Singapore"
. I would like to create a new column that gives that persons timestamp in the Asia Singapore timezone, so I can do analysis on what time of day the event occurred. There are lots of other Timezones such as America/New_York, America/Chicago, etc.
Is there a way to do this efficiently? I have just over 2 million rows in the dataset.
Example Data is as follows:
Event Timestamp | Timezone | Local Time
2019-10-23 18:48:36.291 | Timezone:"America/Anchorage" | ''
2019-10-04 07:55:34.964 | Timezone:"Asia/Jerusalem" | ''
Expected output is to generate Local Time column for the Event Timestamp in that timezone. As mentioned, Event Timestamp is in UTC.
I now have my local time as the UTC time + or - an amount of hours to convert it. How can I get the new local column to just read as a local timestamp?
Current Data:
Event Timestamp | Timezone | Local Time
2019-10-23 18:48:36.291 | Timezone:"America/Anchorage" | '2019-10-23 18:48:36.291000-08:00'
Expected Output:
Event Timestamp | Timezone | Local Time
2019-10-23 18:48:36.291 | Timezone:"America/Anchorage" | '2019-10-23 10:48:36.291000'