Skip to content Skip to sidebar Skip to footer

Timestamp Subtraction Must Have The Same Timezones Or No Timezones

I've parsed a number of date times and have converted them into different time zones. However, when trying to write the data frame to an excel file with df.to_excel I receive the f

Solution 1:

Try to switch those arguments for tz_localize and tz_convert - you should first get a timezone-aware time presented with the actual timezone and then convert it to "US/Pacific":

raw_time = pd.Timestamp(x[1])
loc_raw_time = raw_time.tz_localize(zones[x[0]])
return loc_raw_time.tz_convert("US/Pacific").replace(tzinfo=None)

Post a Comment for "Timestamp Subtraction Must Have The Same Timezones Or No Timezones"