Description:
Get the most frequently appearing members from a sequence or a table sequence.
Syntax:
A.mode() |
A.mode(x) |
Note:
The function gets the most frequently appearing ones among the non-null members in sequence/table sequence A. When there are multiple members that have same number of appearances, the function returns one of them randomly.
Members of the sequence or table sequence can all be nulls. In this case the function returns null. When there are both null members and non-null members, just ignore the null ones and get the desired member from the non-null ones.
Parameter:
A |
A sequence/table sequence |
x |
Fields of the table sequence |
Return value:
The most frequently appearing member
Example:
|
A |
|
1 |
=[1,2,"hello",2,"hello",2].mode() |
2 |
2 |
=[15,20,15,20,"hello"].mode() |
20 |
3 |
=[,,,].mode() |
null |
4 |
=["A",,,,"A"].mode() |
"A" |
5 |
==demo.query("select EID,GENDER,DEPT from EMPLOYEE where EID <=10") |
|
6 |
=A5.mode(GENDER) |
Get the most frequently appearing member “F” from GENDER field in A5 |