Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

typeerror: string indices must be integer pandas datareader [duplicate]

I want to print out SPY's stock data however it keeps shows typeerror: string indices must be integer

import pandas_datareader.data as web

spy = web.get_data_yahoo('SPY',start='2022-12-23',end='2022-10-24')

print(spy)
like image 682
umklapper Avatar asked Aug 24 '26 14:08

umklapper


1 Answers

I would solve for this way:

import pandas
from pandas_datareader import data as pdr
import yfinance as yfin


yfin.pdr_override()

spy = pdr.get_data_yahoo('SPY', start='2022-10-24', end='2022-12-23')

print(spy)

I think it will work.

like image 57
Lucas Lima Avatar answered Aug 27 '26 04:08

Lucas Lima



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!