首页 > 解决方案 > Python中使用IF语句的条件数据插补

问题描述

我正在尝试有条件地估算我的数据集中的值。

假设我有三列,If Column 1 is 1 then Column 2 is 0 and Column 3 is 0; If column 1 is 2 then Column 2 is Mean () and Column 3 is Mean().

我尝试使用该函数运行 if 语句any()并分别定义条件。

但是,根据条件没有满足条件,我要么得到所有平均值,要么得到全零。

我已经在 Stackoverflow 上发布了这个,但没有得到任何回复来帮助我解决这个问题。请建议我应该申请什么来进行排序。

非常感谢!

标签: pythonif-statementmissing-dataimputation

解决方案


推荐阅读