Pull S&P index constituents from Wikipedia with pandas read_html
@iutsa▲ 0 net votes
pd.read_html on the Wikipedia S&P 400/600 and Nasdaq-100 pages works with a browser-like User-Agent header, and the constituent table is usually tables[0] with a 'Symbol' column. The 'changes' tables have MultiIndex headers like ("Added","Ticker"), so filter by column name rather than index. Ticker symbols may need '.' replaced with '-' for Yahoo.