skfolio.datasets.load_sp500_dataset#

skfolio.datasets.load_sp500_dataset()[source]#

Load the prices of 20 assets from the S&P 500 Index.

This dataset contains daily adjusted closing prices for 20 selected constituents of the S&P 500 Index, covering the period from 1990-01-02 to 2022-12-28.

Caution

This dataset is provided solely for testing and example purposes. It is a stale dataset and does not reflect current or accurate market prices. It is not intended for investment, trading, or commercial use and should not be relied upon as authoritative market data.

Observations

8313

Assets

20

Returns:
dfDataFrame of shape (n_observations, n_assets)

Prices DataFrame

Examples

>>> from skfolio.datasets import load_sp500_dataset
>>> prices = load_sp500_dataset()
>>> prices.head()
                AAPL     AMD       BAC  ...       UNH       WMT      XOM
1990-01-02  0.264  4.125  4.599  0.144  ...  3.322  0.310  3.653  4.068
1990-01-03  0.266  4.000  4.636  0.161  ...  3.322  0.304  3.653  4.027
1990-01-04  0.267  3.938  4.537  0.159  ...  3.322  0.301  3.634  3.987
1990-01-05  0.268  3.812  4.438  0.159  ...  3.322  0.288  3.595  3.966
1990-01-08  0.269  3.812  4.463  0.147  ...  3.322  0.282  3.644  4.027