import pandas_datareader
end = "2022-12-15"
start = "2022-12-15"
stock_list = ["TATAELXSI.NS"]
data = pandas_datareader.get_data_yahoo(symbols=stock_list, start=start, end=end)
print(data)
When I run this code, I get error "TypeError: string indices must be integers"
.
Edit : I have updated the code and passed list as symbol parameter but it still shows the same error
Error :
Traceback (most recent call last):
File "C:\Users\Deepak Shetter\PycharmProjects\100DAYSOFPYTHON\mp3downloader.py", line 7, in <module>
data = pandas_datareader.get_data_yahoo(symbols=[TATAELXSI], start=start, end=end)
File "C:\Users\Deepak Shetter\PycharmProjects\100DAYSOFPYTHON\venv\lib\site-packages\pandas_datareader\data.py", line 80, in get_data_yahoo
return YahooDailyReader(*args, **kwargs).read()
File "C:\Users\Deepak Shetter\PycharmProjects\100DAYSOFPYTHON\venv\lib\site-packages\pandas_datareader\base.py", line 258, in read
df = self._dl_mult_symbols(self.symbols)
File "C:\Users\Deepak Shetter\PycharmProjects\100DAYSOFPYTHON\venv\lib\site-packages\pandas_datareader\base.py", line 268, in _dl_mult_symbols
stocks[sym] = self._read_one_data(self.url, self._get_params(sym))
File "C:\Users\Deepak Shetter\PycharmProjects\100DAYSOFPYTHON\venv\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