I have a list consisting of symbols like ['T.TO', 'VCB.TO']
I have a dataframe like this:
1 RIC Expected Return
2 T.TO 2
3 A.TO 1.1
4 VCB.TO 0.004
5 ASN.TO 3
6 00G.H 1.1
and so one with different RICS. Not all values in RIC column is in symbols.
What I want to do is iterate over symbols and extract corresponding return from the dataframe.
Something like this:
for i in symbols:
if i in df.RIC:
list_returns.append(df.Expected Return.index(i))
I know this is really not the correct syntax to deal with dataframes. I could convert it to a dictionary and then handle it using for loops but is there a way to handle it directly using dataframes?
Expected Output: list_returns = [2, 1.1]
The actual dataframe and symbols list are much larger in size.