Created
January 23, 2021 09:45
-
-
Save ilonacodes/86cddd28309e64fdd868fad846a0485f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
sp_table = pd.read_html('sp500.html') | |
sp = sp_table[0] | |
sp.to_csv('sp500-symbols.csv', columns=['Symbol']) | |
sp = pd.read_csv('sp500-symbols.csv') | |
sp_symbols = sp['Symbol'].to_list() | |
print(sp_symbols) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment