0

The code hasn't been changed in a couple of weeks but today when I tried to run it I got an error

TypeError: string indices must be integers

I haven't changed the code since it last worked with it working a couple days ago.

Should I update pips? Or perhaps pandas? Or it maybe something else, I'm imagining it to be something simple but I might be wrong.

import pandas_datareader as pdr
import datetime
print(pdr.get_data_yahoo("GOOG", start = (datetime.datetime.today() - datetime.timedelta(days=7) )  )['Close'])

Error

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    print(pdr.get_data_yahoo("GOOG", start = (datetime.datetime.today() - datetime.timedelta(days=7) ) )['Close'])
  File "C:\Users\Python\Python310\lib\site-packages\pandas_datareader\data.py", line 80, in get_data_yahoo
    return YahooDailyReader(*args, **kwargs).read()
  File "C:\UsersPython\Python310\lib\site-packages\pandas_datareader\base.py", line 253, in read
    df = self._read_one_data(self.url, params=self._get_params(self.symbols))
  File "C:\UsersPython\Python310\lib\site-packages\pandas_datareader\yahoo\daily.py", line 153, in _read_one_data
    data = j["context"]["dispatcher"]["stores"]["HistoricalPriceStore"]
TypeError: string indices must be integers
wjandrea
  • 28,235
  • 9
  • 60
  • 81
Kieran
  • 21
  • 3

0 Answers0