2.13 分组:逻辑与
在布尔值构成的序列中,聚合时执行逻辑与运算。根据小学生在线教学终端调查表,查看是否每个班级的所有学生都能够使用手机。
| ID | STUDENT_NAME | CLASS | TERMINAL |
|---|---|---|---|
| 1 | Rebecca Moore | Class one | Phone |
| 2 | Ashley Wilson | Class one | Phone,PC,Pad |
| 3 | Rachel Johnson | Class one | Phone,PC,Pad |
| 4 | Emily Smith | Class one | Phone,Pad |
| 5 | Ashley Smith | Class one | Phone,PC |
| 6 | Matthew Johnson | Class one | Phone |
| 7 | Alexis Smith | Class one | Phone,PC |
| 8 | Megan Wilson | Class one | Phone,PC,Pad |
| … | … | … | … |
脚本:
| A | |
|---|---|
| 1 | =T(“survey.xlsx”) |
| 2 | =A1.group(CLASS;~.(TERMINAL.split@c().pos(“Phone”) > 0).cand():CAND) |
A1 读入数据
A2 按班级分组,对每组数据分别用 cand() 计算是不是所有 TERMINAL 都包含 Phone
运行结果:
| CLASS | CAND |
|---|---|
| Class one | true |
| Class two | true |
| Class three | true |
| … | … |
