I have a pandas dataframe where I have a column consisting of strings of date times, these I have converted to datetime with pd.to_datetime(). Then I have tried to convert this column to UTC from Swedish Local time, but get an NonExistentTimeError when converting with pandas. How do I resolve this without removing timestamps?
df['Time'] = pd.to_dataframe(df['Time'])
df['Time'] = df['Time'].dt.tz_localize('Europe/Stockholm')
My dataframe looks like this:
| Time | value |
|---|---|
| 2022-03-26 23:00:00 | 1 |
| 2022-03-27 00:00:00 | 5 |
| 2022-03-27 01:00:00 | 6 |
| 2022-03-27 02:00:00 | 8 |
| 2022-03-27 03:00:00 | 4 |
| 2022-03-27 04:00:00 | 11 |
| 2022-03-27 05:00:00 | 10 |