Why am I getting this error with this simple code?

34 Views Asked by At
Am getting, "TypeError: string indices must be integers"

Am trying to run this code direclty from (https://pandas-datareader.readthedocs.io/en/latest/remote_data.html) on Google Colab:

import pandas_datareader.data as web

df = web.DataReader('GE', 'yahoo', start='2019-09-10', end='2019-10-09')
df.head()

and I get:

TypeError                                 Traceback (most recent call last)
<ipython-input-20-b01a0fdd2948> in <cell line: 6>()
      4 #end = '2019-10-09'
      5 
----> 6 df = web.DataReader('GE', 'yahoo', start='2019-09-10', end='2019-10-09')
      7 df.head()

3 frames
/usr/local/lib/python3.10/dist-packages/pandas_datareader/yahoo/daily.py in _read_one_data(self, url, params)
    151         try:
    152             j = json.loads(re.search(ptrn, resp.text, re.DOTALL).group(1))
--> 153             data = j["context"]["dispatcher"]["stores"]["HistoricalPriceStore"]
    154         except KeyError:
    155             msg = "No data fetched for symbol {} using {}"

TypeError: string indices must be integers
0

There are 0 best solutions below