Changing Timestamps from tz='UTC' to tz='tzutc()'


I have a series from an API call and it gives me the index in the format


>>> 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


>>> 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 import *

Answered By – cheesus

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published