python - 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 上发布了这个,但没有得到任何回复来帮助我解决这个问题。请建议我应该申请什么来进行排序。
非常感谢!
解决方案
推荐阅读
- swift - Swift:无法以编程方式编辑自定义表格单元格的属性
- c# - 如何根据 c# 代码的更改刷新角度视图
- sql - Spring Boot中的本机查询,列表中元组的WHERE条件
- vb.net - 如何在运行时将多个图像从 sql server 显示到多个图片框
- c# - 如何使用或模拟 IWebJobsBuilder 对我的 Azure Function v2 进行集成测试?
- dart - 如何在 Flutter / dart 中生成服务器?
- android - Android admob通过反编译apk防止删除广告
- c++ - 如何在 C++ 中杀死等待超过一分钟或两分钟的线程
- ios - 在 swift 4.2 中将无法识别的选择器发送到实例
- python - 如何将卷积层的输出绘制为散点图?甚至可能吗?