I have 3 columns, Currency, then Column A, Column B and COlumn C.
If Currency column has value GBP, then I want to sum Column A and Column C and the output to be reflected in Column D. if value is Eur, then sum column B and Column C, and output in new column to be created D. I have tried one form or another and it either does not work at all, or it only sums based on one condition but not the other... I am really clueless on how to do this. It would be easy to just do it in excel with an if function but I have to use python..
def rates():
for i in range(df['Currency']):
if i== 'GBP':
df['D'] = df['A']+ df['C']
elif i== 'EUR':
df['D'] = df['B']+ df['C']
else:
rates()