通过易货币和大熊猫进行货币转换

问题描述 投票:4回答:1

我正在尝试将具有不同货币的值转换为“ USD”货币。我尝试了easymoneyCurrencyConvertor软件包,但它们似乎不适用于数据框python。

如果我使用iloc逐行进行转换似乎很正常,但这会花费很多时间。

from easymoney.money import EasyPeasy
ep = EasyPeasy()
ep.currency_converter(df_train['goal'], from_currency=df_train['currency'], to_currency="USD")
Error:  
TypeError: invalid type comparison
python pandas currency
1个回答
2
投票

您需要applyapply才能按行进行处理:

axis=1
© www.soinside.com 2019 - 2024. All rights reserved.