# This used to be `.lookup` which is deprecated in Pandas 1.2.0. A way
# around this is `get_indexer`:
idx = df_test.columns.get_indexer(df_test['Currency'])
df_test['GBP val'] = df_test['Price'] * df_test.values[df.index, idx]
# Output:
Stock Price Currency Date USD CAD EUR GBP GBP val
0 AAPL 123 USD 2020-01-01 1.60 1.70 1.17 1 196.8
1 AAL 21 CAD 2020-01-02 1.50 1.79 1.21 1 37.59
2 BBW 15 EUR 2020-01-03 1.55 1.75 1.18 1 17.7
3 BBY 311 GBP 2020-01-04 1.57 1.74 1.19 1 311
# [Quang Hoang] [so/q/67508455] [cc by-sa 3.0]
$
cheat.sh