I have a series from an API call and it gives me the index in the format
timeseries.index.values >>> Timestamp('2019-10-25 15:33:26.068569856+0000', tz='tzutc()')
Then I’m appending some data with the timestamp:
datetime.utcnow().replace(tzinfo=pytz.UTC), which, sadly, has another format
timeseries.index.values[-1] >>> Timestamp('2019-10-25 15:33:27.388853+0000', tz='UTC')]
Which will cause some errors down the road. How can I create a timestamp thats in the original format (tz=’tzutc())?
from datetime import datetime from dateutil.tz import * datetime.now(tzutc())
Answered By – cheesus