Skip to content

Problem of fetching SP500 component stock list #961

Open
@edmondpqyyy

Description

@edmondpqyyy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions