<p>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.</p>
<p>Pandas infers this and applies these timezones to the dataset, which is why it goes from +2 to +3 difference in winter/summer.</p>
<p>Try replacing <code>'EET'</code> with <code>'Etc/GMT+2'</code>.</p>
<pre><code>data.set_index(data.index.tz_localize(timezone('Etc/GMT+2'), ambiguous='NaT', nonexistent='NaT').tz_convert('UTC'))
</code></pre>

CC BY-SA 4.0
2024-04-17T09:06:57.440Z
hi, I have upvoted your answer, many thanks. I haven't accepted it due to + and - described in my answer.
Dimitris Tsiaousidis
CC BY-SA 4.0
2024-04-17T15:14:32.210Z
Thanks, I'm glad you found a solution!
Rowan
CC BY-SA 4.0
2024-04-18T06:47:27.517Z
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 https://python.readthedocs.io/en/latest/library/time.html
JeopardyTempest
CC BY-SA 4.0
2024-04-18T10:38:01.650Z
@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'
Dimitris Tsiaousidis
CC BY-SA 4.0
2024-04-16T15:25:14.557Z
2024-04-16T15:25:14.557Z
Rowan
<p>The answer of Rowan was very helpful. But, it needs Etc/GMT-2 instead of Etc/GMT+2 to make the conversion.
so,</p>
<p>data.set_index(data.index.tz_localize(timezone('Etc/GMT-2'), ambiguous='NaT', nonexistent='NaT').tz_convert('UTC'))</p>

CC BY-SA 4.0
2024-04-17T09:00:42.033Z
2024-04-17T09:00:42.033Z
Dimitris Tsiaousidis
<p>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.</p>
<p>But I would like 2 hours difference all year, for both winter and summer.</p>
<p>Thanks,
Dimitris</p>

<air-pollution><python><time>
Converting EET to UTC ignoring EEST
Dimitris Tsiaousidis
# Converting EET to UTC ignoring EEST

(Asked by: username_0 on 2024-04-16)

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

**Tags:** air-pollution, python, time


---

## 2 answers

### Answer by username_1 on 2024-04-16. Score: 1

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

```

> **Comments:**
> **username_0**: hi, I have upvoted your answer, many thanks. I haven't accepted it due to + and - described in my answer.  
> **username_1**: Thanks, I'm glad you found a solution!  
> **username_2**: 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 https://python.readthedocs.io/en/latest/library/time.html  
> **username_0**: @username_2 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'  

---

### Answer by username_0 on 2024-04-17. Score: 0

The answer of username_1 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'))


---

