pandas-datareader icon indicating copy to clipboard operation
pandas-datareader copied to clipboard

Problem of fetching SP500 component stock list

Open edmondpqyyy opened this issue 2 years ago • 1 comments

I got an error about fetching the list of SP500 component stock, shown below:

`import pandas_datareader as pdr

define start and end dates

start_date = '2022-01-01' end_date = '2022-12-31'

get the S&P 500 component tickers for each month in 2022

sp500_components = pdr.get_components_yahoo('^GSPC')`


ImmediateDeprecationError Traceback (most recent call last) Input In [136], in <cell line: 8>() 5 end_date = '2022-12-31' 7 # get the S&P 500 component tickers for each month in 2022 ----> 8 sp500_components = pdr.get_components_yahoo('^GSPC')

File ~/opt/anaconda3/lib/python3.9/site-packages/pandas_datareader/yahoo/components.py:30, in _get_data(idx_sym) 9 def _get_data(idx_sym): # pragma: no cover 10 """ 11 Returns DataFrame containing list of component information for 12 index represented in idx_sym from yahoo. Includes component symbol (...) 28 idx_df : DataFrame 29 """ ---> 30 raise ImmediateDeprecationError(DEP_ERROR_MSG.format("Yahoo Components")) 31 stats = "snx" 32 # URL of form: 33 # http://download.finance.yahoo.com/d/quotes.csv?s=@%5EIXIC&f=snxl1d1t1c1ohgv

ImmediateDeprecationError: Yahoo Components has been immediately deprecated due to large breaks in the API without the introduction of a stable replacement. Pull Requests to re-enable these data connectors are welcome.

See https://github.com/pydata/pandas-datareader/issues

edmondpqyyy avatar Apr 25 '23 18:04 edmondpqyyy

Running into this same error. Any update?

Invesst avatar Apr 24 '24 03:04 Invesst