My raw data has a column with timestamps in ISO8601 format like this:
'2017-07-25T06:00:02+02:00'
Since the data is in CSV format, it will be read as object/string. Therefore I'm converting it to datetime like this.
import pandas pd
df['time'] = pd.to_datetime(df['time'], utc=False)
#df['time'][0]
df['time'][0].isoformat()
Unfortunately this results in UTC timestamps and the timezone is lost. For instance df['time'][0].tzinfo is not set.
Timestamp('2017-07-25 04:00:02')
'2017-07-25T04:00:02'
I'm looking for a way to keep the timezone info in each of the timezone objects. But without re-setting it to CEST (Central European Summer Time) afterwards since this information is already included in the ISO8601 timezone offset in the raw-data. Any idea how to do this?