查找数据集中的项目数

时间:2018-03-08 20:44:06

标签: count

当试图找到一个单词在数据集中重复的次数时...例如,如果一列有East Northeast和West,我试图找到有多少东北有?

2 个答案:

答案 0 :(得分:0)

在Javascript中:

const column = ['east', 'west', 'northeast', 'west', 'northeast', 'south'];

const frequency = column.filter(word => word === 'northeast').length

此处frequency的值为2

答案 1 :(得分:0)

SQL:

SELECT COUNT(column) FROM dataset WHERE column LIKE '%Northeast%'

C#:

int count = dataSet.dataTable[0].AsEnumerable()
           .Count(row => row.Field<string>("Column-A") == "Northeast");