Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

TypeError: string indices must be integers in pandas_datareader.DataReader

I am trying to get facebook stock prices with pandas_datareader but it gives me this error. can anyone help me out?

company = 'FB'

start = dt.datetime(2012, 1, 1)
end = dt.datetime.now()

data = pdr.DataReader(company, 'yahoo', start, end)

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Looks like yahoo made changes to their API:

related git: https://github.com/pydata/pandas-datareader/issues/952

One way can be:

import yfinance as yf

df = yf.download(company, start , end)

yf.download also returns a dataframe.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading