Skip to content Skip to sidebar Skip to footer

Pandas: Read Timestamp From Csv In Gmt Then Resample

I have a CSV with epoch GMT timestamp at irregular intervals paired with a value. I tried reading it from the CSV but all the times zones are shifted to my local timezone. How ca

Solution 1:

Convert local datetime to GMT datetime like this:

gmtDatetime = localdatetime - datetime.timedelta(hours=8)

The time zone is +08 (China).

Or using 'datetime.utcfromtimestamp':

classmethod datetime.utcfromtimestamp(timestamp)
classmethod datetime.fromtimestamp(timestamp, tz=None)

Return the UTC datetime corresponding to the POSIX timestamp, with tzinfo None. This may raise OverflowError, if the timestamp is out of the range of values supported by the platform C gmtime() function, and OSError on gmtime() failure. It’s common for this to be restricted to years in 1970 through 2038. See also fromtimestamp().

Post a Comment for "Pandas: Read Timestamp From Csv In Gmt Then Resample"