skfolio.datasets
.load_sp500_dataset#
- skfolio.datasets.load_sp500_dataset()[source]#
Load the prices of 20 assets from the S&P 500 Index composition.
This dataset is composed of the daily prices of 20 assets from the S&P 500 composition starting from 1990-01-02 up to 2022-12-28.
The data comes from the Yahoo public API. The price is the adjusted close which is the closing price after adjustments for all applicable splits and dividend distributions. The adjustment uses appropriate split and dividend multipliers, adhering to the Center for Research in Security Prices (CRSP) standards.
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.332589 4.1250 11.65625 ... 0.382813 5.890625 12.5000 1990-01-03 0.334821 4.0000 11.75000 ... 0.375000 5.890625 12.3750 1990-01-04 0.335938 3.9375 11.50000 ... 0.371094 5.859375 12.2500 1990-01-05 0.337054 3.8125 11.25000 ... 0.355469 5.796875 12.1875 1990-01-08 0.339286 3.8125 11.31250 ... 0.347656 5.875000 12.3750