I'm trying to loop across a list of exchange rate dataframes, to calculate the cross rate and convert them into a different base currency. The code I'm currently running is:
forex_dataframes = [aud_df, eur_df, gbp_df, nzd_df, cny_df, jpy_df]
for i in forex_dataframes:
if (i == nzd_df).all():
continue
else:
i = nzd_df / i
The calculation should be nzd_df / *currency_df*
for every dataframe except nzd_df, as this is already correct.
When I run this code though I'm getting
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()
I'm not sure why this is the case as when I print it individually (e.g. (nzd_df == nzd_df).all()
) I get a single boolean value back.
Note the forex_dataframes
list needs to be in this particular order, but if there is another way of skipping the nzd_df item I'm happy to go with that.
Any help is appreciated, thanks.