源数据,三列分别表示 中心编号,受试者代码,受试结果
[
['CHN001', 'CHN001014', true ],
['CHN002', 'CHN002001', true ],
['CHN002', 'CHN002001', false ],
['CHN002', 'CHN002002', true ],
['CHN002', 'CHN002002', false ],
['CHN002', 'CHN002003', true ],
['CHN002', 'CHN002004', true ],
['CHN002', 'CHN002005', true ],
['CHN002', 'CHN002007', false ],
['CHN002', 'CHN002008', false ],
['CHN003', 'CHN003001', true ],
['CHN003', 'CHN003001', false ],
['CHN005', 'CHN005001', true ],
['CHN005', 'CHN005001', false ],
['CHN005', 'CHN005002', true ],
['CHN005', 'CHN005003', true ],
['CHN005', 'CHN005004', true ],
['CHN007', 'CHN007001', true ],
['CHN007', 'CHN007001', false ],
['CHN007', 'CHN007001', false ],
['CHN007', 'CHN007002', true ],
['CHN007', 'CHN007003', true ],
['CHN007', 'CHN007003', false ],
['CHN007', 'CHN007004', true ],
['CHN007', 'CHN007004', true ],
['CHN007', 'CHN007004', false ],
['CHN007', 'CHN007007', true ],
['CHN007', 'CHN007008', true ],
['CHN007', 'CHN007009', false ]
]
要求:
按照,中心编号和受试者代码分组,
比如 CHN005 下面包含了4个受试者,为CHN005001,CHN005002,CHN005003,CHN005004
['CHN005', 'CHN005001', true ],
['CHN005', 'CHN005001', false ],
['CHN005', 'CHN005002', true ],
['CHN005', 'CHN005003', true ],
['CHN005', 'CHN005004', true ],
CHN005001 下面又有两条记录,只有同时都是true,才按累加1处理
['CHN005', 'CHN005001', true ],
['CHN005', 'CHN005001', false ],
所以 CHN005001 为0
CHN005002,CHN005003,CHN005004都为1,最终
CHN005结果 为3
期望输出结果:
"CHN001" "1"
"CHN002" "3"
"CHN005" "3"
"CHN007" "4"