Creating a new column based on values from other columns in python pandas

Viewed 7620

I have a pandas dataframe with one column showing currencies and another showing prices. I want to create a new column that standardizes the prices to USD based on the values from the other two columns.

eg.

  currency   price
  SGD        100
  USD        80
  EUR        75

the new column would have conditions similar to

if currency == SGD: price = price / 1.37 etc.

so in the end it would look like

  currency   price   new_price
  SGD        100     72.99
  USD        80      80
  EUR        75      65.22
1 Answers
Related