'yfinance "history" function not working with python
Im trying to run a simple history function on certain dates and keep getting the error " df.index = df.index.tz_localize("UTC").tz_convert( AttributeError: 'Index' object has no attribute 'tz_localize' "
here is my code:
import yfinance as yf
aapl = yf.Ticker("AAPL")
hist = aapl.history(start='2022-01-10', end='2022-01-20')
Solution 1:[1]
I've run into the same problem and I'd found the solution in https://github.com/ranaroussi/yfinance/issues/937.
I had to make changes to the utils.py file for it to work.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dharman |
