I have measurements of pollutants. data = data.set_index(data.index.tz_localize(timezone('EET'), ambiguous='NaT', nonexistent='NaT').tz_convert('UTC')) This command converts the EET time to UTC. It considers, 2 hours difference in winter and 3 in summer.

But I would like 2 hours difference all year, for both winter and summer.

Thanks, Dimitris


2 Answers 2


It might be better to localize the data into GMT+2 or GMT+3 instead of EET. EET is GMT+2 in the winter, and GMT+3 in the summer.

Pandas infers this and applies these timezones to the dataset, which is why it goes from +2 to +3 difference in winter/summer.

Try replacing 'EET' with 'Etc/GMT+2'.

data.set_index(data.index.tz_localize(timezone('Etc/GMT+2'), ambiguous='NaT', nonexistent='NaT').tz_convert('UTC'))
  • $\begingroup$ hi, I have upvoted your answer, many thanks. I haven't accepted it due to + and - described in my answer. $\endgroup$ Commented Apr 17 at 9:06
  • 1
    $\begingroup$ Thanks, I'm glad you found a solution! $\endgroup$
    – Rowan Nag
    Commented Apr 17 at 15:14
  • $\begingroup$ Wouldn't data = data.set_index(data.index.tz_localize(timezone('EEST'), ambiguous='NaT', nonexistent='NaT').tz_convert('UTC')) just work? I see it's name is in the timezone name set for Egypt in python.readthedocs.io/en/latest/library/time.html $\endgroup$ Commented Apr 18 at 6:47
  • $\begingroup$ @JeopardyTempest hello, no : 1) eest in 3 hours ahead i want 2. 2) it returns error. Traceback (most recent call last): File "H:\My Drive\PhD\2024\climpact\rest_of_greece.py", line 293, in <module> dict_2019_data[str(file)] = dict_2019_data[str(file)].set_index(dict_2019_data[str(file)].index.tz_localize(timezone('EEST'), ambiguous='NaT', nonexistent='NaT') File "C:\Users\Administrator\anaconda3_synced\lib\site-packages\pytz_init_.py", line 181, in timezone raise UnknownTimeZoneError(zone) UnknownTimeZoneError: 'EEST' $\endgroup$ Commented Apr 18 at 10:38

The answer of Rowan was very helpful. But, it needs Etc/GMT-2 instead of Etc/GMT+2 to make the conversion. so,

data.set_index(data.index.tz_localize(timezone('Etc/GMT-2'), ambiguous='NaT', nonexistent='NaT').tz_convert('UTC'))


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.