yfinance icon indicating copy to clipboard operation
yfinance copied to clipboard

Compatibilty with Python 3.10.2

Open TheRobinLu opened this issue 3 years ago • 2 comments

Just upgrade Python to 3.10.02, when downloaded data, got following error. yf.download('AMD', interval="1d", start="2021-01-11", group_by="ticker")

Exception in thread Thread-1 (_run_via_pool): Traceback (most recent call last): File "C:\Users\lurob\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner self.run() File "C:\Users\lurob\AppData\Local\Programs\Python\Python310\lib\threading.py", line 946, in run self._target(*self._args, **self.kwargs) File "E:\Project\Python\Test310\venv\lib\site-packages\multitasking_init.py", line 104, in _run_via_pool return callee(*args, **kwargs) File "E:\Project\Python\Test310\venv\lib\site-packages\yfinance\multi.py", line 188, in _download_one_threaded data = _download_one(ticker, start, end, auto_adjust, back_adjust, File "E:\Project\Python\Test310\venv\lib\site-packages\yfinance\multi.py", line 202, in _download_one return Ticker(ticker).history(period=period, interval=interval, File "E:\Project\Python\Test310\venv\lib\site-packages\yfinance\base.py", line 295, in history df.index = df.index.tz_localize("UTC").tz_convert( AttributeError: 'Index' object has no attribute 'tz_localize'

any advise?

TheRobinLu avatar Jan 24 '22 22:01 TheRobinLu

The issue isn't python, it's pandas 1.4, duplicate of #937

moshfrid avatar Jan 24 '22 22:01 moshfrid

This is a problem with python 3.10 as well. When I downgraded Pandas to 1.3.5 it still had the same error. Downgrading both python and pandas solved it

aaronweewee avatar Jan 28 '22 11:01 aaronweewee

This was fixed soon after reporting: https://github.com/ranaroussi/yfinance/issues/937#issuecomment-1025131425

ValueRaider avatar Oct 28 '22 13:10 ValueRaider