I have a pandas DataFrame containing stocks that looks like this:
Name Ticker Currency
0 TOTAL SA FP FP EUR
1 APPLE INC AAPL US USD
2 ALPHABET INC-CL A GOOGL US USD
I have another containing prices:
AAPL US FP FP GOOGL US
Date
2018-08-01 200.0000 55.0000 1235.0000
2018-08-02 201.0000 56.0000 1236.0000
2018-08-03 202.0000 57.0000 1237.0000
and another containing FXs:
EUR USD
Date
2018-08-01 1.1300 1.3000
2018-08-02 1.1400 1.3100
2018-08-03 1.1500 1.3200
I want to create a new DataFrame with the same columns as the price one containing FX rates. I want to do that by using the currency column of the stocks DataFrame as a lookup and selecting the correct values from the FX DataFrame so I get something like this:
AAPL US FP FP GOOGL US
Date
2018-08-01 1.3000 1.1300 1.3000
2018-08-02 1.3100 1.1400 1.3100
2018-08-03 1.3200 1.1500 1.3200
I cannot seem to find the right function that allows me to do this.