How to use the pandas_datareader library?

803 Views Asked by At


TypeError: string indices must be integers

I imported this library but it's not giving error

from pandas_datareader import data as pdr
import datetime as dt

start_date = dt.datetime(2021, 1, 1)
end_date = dt.datetime(2021, 12, 31)

df = pdr.get_data_yahoo('AAPL', start=start_date, end=end_date)
print(df.head())
1

There are 1 best solutions below

0
Vladimir Abramov On

You can import yfinance:

import yfinance as yf
yf.pdr_override()

Than just use your code. It works for me.