0

Where can I found on https://spglobal.com S&P 500 index actual official stock weights.

1 Answer 1

1

I found one source that has the data as an html table.

https://www.slickcharts.com/sp500

You can use pandas to parse the html table as a dataframe, and then write a csv:

import pandas as pd
import requests

df = pd.read_html(requests.get('https://www.slickcharts.com/sp500',
                      headers={'User-agent': 'Mozilla/5.0'}).text)[0]

print(df)
df.to_csv('sp.csv',index=False)

And here's the data as of 2021-05-06

https://gist.github.com/philshem/f2fc94d7e49f045fe0feda8532ab2c08#file-sp-csv

1
  • I know about slickchart, but I search official information. Thanks anyway for the answer.
    – Vitalii
    Commented May 7, 2021 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.