Python pandas convert unix timestamp with timezone into datetime
问题 I have a dataframe: df = pd.DataFrame({'unix_utc_ts': [1503007204222, 1503007210206, 1503007215121, 1503007220475], 'tz': ['+0000', '+0100', 'CEST', 'EEST']}) And I want to convert unix timestamps into datetime with timezone, so I want something like this: df['local_ts'] = pd.to_datetime(df['unix_utc_ts'], unit='ms', tz=df['tz']) The above code doesn't work. Without the tz argument I get this: tz unix_utc_ts utc_ts 0 +0000 1503007204222 2017-08-17 22:00:04.222 1 +0100 1503007210206 2017-08-17