question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

yahoo_financials.get_key_statistics_data() TypeError: string indices must be integers

See original GitHub issue

yahoo_financials.get_key_statistics_data(), Suddenly started throwing error: TypeError: string indices must be integers. Not sure anybody using this python module experiencing the error.

`from yahoofinancials import YahooFinancials

ticker = ‘AAPL’ yahoo_financials = YahooFinancials(ticker)

conentKeys = yahoo_financials.get_key_statistics_data()

Traceback (most recent call last):

File “/Users/raj/opt/miniconda3/lib/python3.8/runpy.py”, line 194, in _run_module_as_main return _run_code(code, main_globals, None, File “/Users/raj/opt/miniconda3/lib/python3.8/runpy.py”, line 87, in _run_code exec(code, run_globals) File “/Users/raj/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/adapter/…/…/debugpy/launcher/…/…/debugpy/main.py”, line 39, in <module> cli.main() File “/Users/raj/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/adapter/…/…/debugpy/launcher/…/…/debugpy/…/debugpy/server/cli.py”, line 430, in main run() File “/Users/raj/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/adapter/…/…/debugpy/launcher/…/…/debugpy/…/debugpy/server/cli.py”, line 284, in run_file runpy.run_path(target, run_name=“main”) File “/Users/raj/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py”, line 321, in run_path return _run_module_code(code, init_globals, run_name, File “/Users/raj/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py”, line 135, in _run_module_code _run_code(code, mod_globals, init_globals, File “/Users/raj/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py”, line 124, in _run_code exec(code, run_globals) File “/Users/raj/Code/Machine_Learning/wb-starter/scrap_yahoo_finance3.py”, line 7, in <module> conentKeys = yahoo_financials.get_key_statistics_data() File “/Users/raj/opt/miniconda3/lib/python3.8/site-packages/yahoofinancials/init.py”, line 613, in get_key_statistics_data return self.get_clean_data(self.get_stock_tech_data(‘defaultKeyStatistics’), ‘defaultKeyStatistics’) File “/Users/raj/opt/miniconda3/lib/python3.8/site-packages/yahoofinancials/init.py”, line 492, in get_stock_tech_data return self.get_stock_data(statement_type=‘keystats’, tech_type=tech_type) File “/Users/raj/opt/miniconda3/lib/python3.8/site-packages/yahoofinancials/init.py”, line 476, in get_stock_data dict_ent = self._create_dict_ent(self.ticker, statement_type, tech_type, report_name, hist_obj) File “/Users/raj/opt/miniconda3/lib/python3.8/site-packages/yahoofinancials/init.py”, line 409, in _create_dict_ent re_data = self._scrape_data(YAHOO_URL, tech_type, statement_type) File “/Users/raj/opt/miniconda3/lib/python3.8/site-packages/yahoofinancials/init.py”, line 169, in _scrape_data stores = data[“context”][“dispatcher”][“stores”][“QuoteSummaryStore”][tech_type] TypeError: string indices must be integers `

Issue Analytics

  • State:open
  • Created 9 months ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
sedwards2000commented, Dec 19, 2022

I have created a pull request with the fix hopefully it will be accepted too. I found the fix on a separate package: https://github.com/ranaroussi/yfinance/pull/1253/commits/8e5f0984af347afda6be74b27a989422e49a975b

0reactions
RobinMoRicommented, Dec 23, 2022

I also get the same issue using yahoo_financials.get_current_price() method. Any update on this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

why am I getting a "TypeError: String indices Must be integer ...
I'm following along with a Udemy course for Python & Finance, unfortunately hit a wall whilst trying to call stock data from yahoo...
Read more >
TypeError String Indices Must be Integers Python Error [Solved]
TypeError : string indices must be integers. In this article, I will show you examples of why you might receive this error message...
Read more >
Python typeerror: string indices must be integers Solution
This error indicates that we are trying to access a value from an iterable using a string index rather than an integer index....
Read more >
string indices must be integers" when getting data of a stock ...
" TypeError : string indices must be integers " when getting data of a stock from Yahoo Finance using Pandas DatareaderI hope you...
Read more >
List Indices Must Be Integers Or Slices, Not 'Str'? - YouTube
Full Tutorial / Article Link: https://blog.finxter.com/how-to-fix- typeerror -list- indices - must-be-integers -or-slices-not-str/PyCharm Course: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found