【发布时间】:2019-08-23 13:32:23
【问题描述】:
我有一个包含两个数据框的列表。我正在尝试根据“已婚”的值为 NULL 来更新“家属”列。
for dataset in data_cleaner:
dataset[dataset.Dependents.isnull()].loc[dataset.Dependents.isnull() and dataset['Married']=='Yes' ] ='1'
dataset[dataset.Dependents.isnull()].loc[dataset.Dependents.isnull() and dataset['Married']=='No' ] ='0'
错误:Series 的真值不明确。使用 a.empty、a.bool()、a.item()、a.any() 或 a.all()。
也尝试了 if else 条件并得到相同的错误。我在这里错过或不理解什么?
【问题讨论】:
-
请发布错误。