77Licensed under GNU LGPL.3, see LICENCE file
88'''
99
10-
11-
1210import os
1311from typing import Optional , Union , Any
1412import pandas as pd
@@ -35,24 +33,28 @@ def load_data_msci(path: str = None, n: int = 24) -> dict[str, pd.DataFrame]:
3533 '''Loads MSCI daily returns data from 1999-01-01 to 2023-04-18'''
3634
3735 path = os .path .join (os .getcwd (), f'data{ os .sep } ' ) if path is None else path
38- # Load msci country index return series
36+
37+ # --- FILE 1: MSCI Country Indices ---
3938 df = pd .read_csv (os .path .join (path , 'msci_country_indices.csv' ),
40- sep = ';' ,
39+ sep = ',' , # FIXED: Separator is comma
4140 index_col = 0 ,
4241 header = 0 ,
4342 parse_dates = True )
44- df .index = pd .to_datetime (df .index , format = '%d/%m/%Y' )
43+
44+ # FIXED: Date format uses dashes
45+ df .index = pd .to_datetime (df .index , format = '%d-%m-%Y' )
46+
4547 series_id = df .columns [0 :n ]
4648 X = df [series_id ]
4749
48- # Load msci world index return series
50+ # --- FILE 2: World Index (NDDLWI) ---
4951 y = pd .read_csv (f'{ path } NDDLWI.csv' ,
50- sep = '; ' ,
52+ sep = ', ' ,
5153 index_col = 0 ,
5254 header = 0 ,
5355 parse_dates = True )
5456
55- y .index = pd .to_datetime (y .index , format = '%d/%m/%Y' )
56-
57- return {'return_series' : X , 'bm_series' : y }
57+ # FIXED: Date format uses dashes here too (Line 55 fixed)
58+ y .index = pd .to_datetime (y .index , format = '%d-%m-%Y' )
5859
60+ return {'return_series' : X , 'bm_series' : y }
0 commit comments