Description:
Get the most frequently appearing members from a sequence or a table sequence.
Syntax:
A.mode(x) |
|
mode(x1,…,xn) |
Equivalent to A.mode(), where x1,…,xn are members of sequence A |
Note:
The function gets the most frequently appearing ones among the non-null members in sequence A. When there are multiple members that have same number of appearances, the function returns one of them randomly. The function returns null when all members are nulls.
Parameter:
A |
A sequence |
x |
An expression; cannot be omitted when sequence A is a table sequence or a record sequence |
Return value:
The most frequently appearing member
Example:
When A is a sequence:
|
A |
|
1 |
=[1,2,"hello",2,"hello",2].mode() |
2. |
2 |
=[15,20,15,20,"hello"].mode() |
20; as 15 and 20 have same appearing frequency, one of them is returned randomly. |
3 |
=[,,,].mode() |
Return null because all members of the sequence are nulls. |
4 |
=["A",,,,"A"].mode() |
"A". |
5 |
=mode(1,2,"hello",2,"hello",2) |
2, which is same as A1. |
When A is a table sequence or a record sequence:
|
A |
|
1 |
=demo.query("select EID,GENDER,DEPT from EMPLOYEE where EID <10") |
|
2 |
=A1.mode(DEPT) |
Get the most-frequently appearing DEPT value from table sequence A1 and return Sales. |