Greetings,
Can't figure out the error from the notebook:
# Import pandas datareader
import pandas as pd
import pandas_datareader as pdr
# Set the start and end date
start_date = '01-Jan-10'
end_date = '01-Feb-20'
# Set the ticker
ticker = 'V'
# Get stock data
data = pdr.get_data_yahoo(ticker, start_date, end_date)['Adj Close']
# Print the top 5 rows of the pandas series
data.head()
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[8], line 17 14 from datetime import datetime 16 # Get stock data ---> 17 data = pdr.get_data_yahoo(ticker, start_date, end_date)['Adj Close'] 19 # Print the top 5 rows of the pandas series 20 data.head() File ~/.conda/envs/quantra_py/lib/python3.9/site-packages/pandas_datareader/data.py:80, in get_data_yahoo(*args, **kwargs) 79 def get_data_yahoo(*args, **kwargs): ---> 80 return YahooDailyReader(*args, **kwargs).read() File ~/.conda/envs/quantra_py/lib/python3.9/site-packages/pandas_datareader/base.py:253, in _DailyBaseReader.read(self) 251 # If a single symbol, (e.g., 'GOOG') 252 if isinstance(self.symbols, (string_types, int)): --> 253 df = self._read_one_data(self.url, params=self._get_params(self.symbols)) 254 # Or multiple symbols, (e.g., ['GOOG', 'AAPL', 'MSFT']) 255 elif isinstance(self.symbols, DataFrame): File ~/.conda/envs/quantra_py/lib/python3.9/site-packages/pandas_datareader/yahoo/daily.py:153, in YahooDailyReader._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 Please help Thanks