I am scraping stock market data from yfinance. My code worked perfectly during the last weeks. For some reason, now I am receiving the following error:
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
when executing:
import yfinance as yf tsla_df = yf.download('TSLA', start='2020-01-01', end='2021-01-01', progress=False)
I have read about this error on Stack Overflow, but no one had an appropriate solution to fix the problem. I am wondering because this simple code worked well days ago. So maybe there is a general problem with the yfinance API at the moment? Can anyone confirm or has a solution for this problem?
Advertisement
Answer
Issue has been raised with yfinance, you need to upgrade
Follow here
https://github.com/ranaroussi/yfinance/issues/764
from github:
If you’re getting an json.decoder.JSONDecodeError related error, please upgrade to yfinance 0.1.62. Upgrade using:
$ pip install yfinance -U–no-cache-dir
Full conversation here : https://github.com/ranaroussi/yfinance/issues/760
I couldn’t get the fix to work but this comment worked for me https://github.com/ranaroussi/yfinance/issues/760#issuecomment-877379498
pip uninstall yfinance pip install git+https://github.com/ranaroussi/yfinance.git#egg=yfinance