turicreate.SArray.value_counts

SArray.value_counts()

Return an SFrame containing counts of unique values. The resulting SFrame will be sorted in descending frequency.

Returns:
out : SFrame

An SFrame containing 2 columns : ‘value’, and ‘count’. The SFrame will be sorted in descending order by the column ‘count’.

See also

SFrame.summary

Examples

>>> sa = turicreate.SArray([1,1,2,2,2,2,3,3,3,3,3,3,3])
>>> sa.value_counts()
    Columns:
            value       int
            count       int
    Rows: 3
    Data:
    +-------+-------+
    | value | count |
    +-------+-------+
    |   3   |   7   |
    |   2   |   4   |
    |   1   |   2   |
    +-------+-------+
    [3 rows x 2 columns]