Hello,
I use the simple python line of code to get the constituents of S&P500:
data1= ds.get_data(tickers="LS&PCOMP", fields='P,PE,MV,NAME,RIC')
However I cannot make sense of the dataframe it returns. It seems to have multiple layers and I can't see how to iterate through the dataframe to create a simple list of (Id, P,PE,MV,NAME,RIC) for each constituent of S&P500.
data1 Out[114]: Instrument 891399 916328 545101 777953 906187 936365 749382 891631 \ Field P P P P P P P P Date 2019-03-22 1764.77 77.97 18.06 323.21 139.45 26.37 259.6899 141.72
I am sure it's not that difficult but I would greatly appreciate help on this.
Many thanks.
Charles