Open mreiche opened 9 months ago
I was now able to reproduce this in my DEV setup. It seems to be related to specific symbols. I'm investigating. The change came with 4a5616d5c40da3dcd1350282329869fe19aea6e9
Just a thought: does this error occur when tickers from different timezones? Mixing timezones can cause problems in Pandas. Easily solved though.
Another thought: does downgrading Pandas to below 2.1 help? That introduced a subtle datetime bug that can propagate and cause chaos.
I'm experiencing this bug again in Pandas.
In multi.py
line 214
data.index = _pd.to_datetime(data.index)
where data.index
is:
Index([2024-08-07 09:05:00+02:00, 2024-08-07 10:40:00+02:00,
2024-08-07 13:15:00+02:00, 2024-08-07 13:20:00+02:00,
2024-08-07 09:30:00-04:00, 2024-08-07 09:35:00-04:00,
2024-08-07 09:40:00-04:00, 2024-08-07 09:45:00-04:00,
2024-08-07 09:50:00-04:00, 2024-08-07 09:55:00-04:00,
2024-08-07 10:00:00-04:00, 2024-08-07 10:05:00-04:00,
2024-08-07 10:10:00-04:00, 2024-08-07 10:15:00-04:00,
2024-08-07 10:20:00-04:00, 2024-08-07 10:25:00-04:00,
2024-08-07 10:30:00-04:00, 2024-08-07 10:35:00-04:00,
2024-08-07 10:40:00-04:00, 2024-08-07 10:45:00-04:00,
2024-08-07 10:50:00-04:00, 2024-08-07 10:55:00-04:00,
2024-08-07 11:00:00-04:00, 2024-08-07 11:05:00-04:00,
2024-08-07 11:10:00-04:00, 2024-08-07 11:15:00-04:00,
2024-08-07 11:20:00-04:00, 2024-08-07 11:25:00-04:00,
2024-08-07 11:30:00-04:00, 2024-08-07 11:35:00-04:00,
2024-08-07 11:40:00-04:00, 2024-08-07 11:45:00-04:00,
2024-08-07 11:50:00-04:00, 2024-08-07 11:55:00-04:00,
2024-08-07 12:00:00-04:00, 2024-08-07 12:05:00-04:00,
2024-08-07 12:10:00-04:00, 2024-08-07 12:15:00-04:00,
2024-08-07 12:20:00-04:00, 2024-08-07 12:25:00-04:00,
2024-08-07 12:30:00-04:00, 2024-08-07 12:35:00-04:00,
2024-08-07 12:40:00-04:00, 2024-08-07 12:45:00-04:00,
2024-08-07 12:50:00-04:00],
dtype='object')
It fails with:
Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True, at position 4
Position 4 has a timezone of -4
.
Describe bug
I get the error
Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True
when downloading history data in PROD.My PROD setup:
Simple code that reproduces your problem
I cannot reproduce the error in my DEV setup, butthe pseudo code leading to this error, is the following:My DEV setup:
When setting
ignore_tz=True
the error disappears (leading to another error that's not covered by this issue here).Debug log
Bad data proof
No response
yfinance
version0.2.35 Previous tested version 0.2.32 works fine.
Python version
3.11.5
Operating system
Linux 6c9a93488545 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023 x86_64 GNU/Linux Podman 3.4.4