2.7 非重复计数

 

序表中数据聚合时,非重复计数。分析数据文件中哪个字段最适合被设定为主键列。

PassengerId Survived Pclass Name Sex Age
1 0 3 “Braund, Mr. Owen Harris” male 22
2 1 1 “Cumings, Mrs. John Bradley” female 38
3 1 3 “Heikkinen, Miss. Laina” female 26
4 1 1 “Futrelle, Mrs. Jacques Heath” female 35
5 0 3 “Allen, Mr. William Henry” male 35
6 0 3 “Moran, Mr. James” male
7 0 1 “McCarthy, Mr. Timothy J” male 54

脚本:

A
1 =T(“titanic_train.xlsx”)
2 =A1.fno().new(A1.fname(~):Name,A1.field(~).icount():DCount)
3 =A2.select(DCount==A1.len())

A2 使用 icount() 函数计算每个字段的非重复成员的数量
A3 选出非重复计数与全部数据长度相同的字段