I'm trying to run the following code after the necessary library imports:
import numpy as np
import pandas as pd
import yfinance as yf
import pandas_datareader as web
import datetime as dt
tickers = ['BAC','JPM','C','NSRGY']
start_date = dt.datetime(2019,2,1)
end_date = dt.datetime(2019,12,30)
data = web.DataReader(tickers, 'yahoo', start_date, end_date)
And I end up with this TypeError which I don't quite understand (not posting the whole error):
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/var/folders/pv/98lyfc8n6tzbdrydqyjpt2qm0000gn/T/ipykernel_3109/4067046804.py in <module>
2 start_date = dt.datetime(2019,2,1)
3 end_date = dt.datetime(2019,12,30)
----> 4 data = web.DataReader(tickers, 'yahoo', start_date, end_date)
TypeError: string indices must be integers
The code seemed to be working for me the other day when I used it, perhaps I've made a silly mistake somewhere.