I have a currency exchange dictionary, as follows:
exchange_rates = {'USD': 1.00000,
'EUR': 1.32875,
'GBP': 1.56718, ...}
Then I retrieve the sales information for a product, using:
SELECT price, currency FROM sales
There are perhaps a million rows, which may look like this:
- 2.99 USD
- 3.01 EUR
- etc.
How would I do matrix multiplication to get the total sum in USD?