WLJS LogoWLJS Notebook

Counts

Counts[list] gives an association whose keys are the distinct elements and values are their counts.

Examples

Count element occurrences:

Counts[{a, b, a, c, b, a}]
(* <|a -> 3, b -> 2, c -> 1|> *)

Count characters:

Counts[Characters["mississippi"]]
(* <|"m" -> 1, "i" -> 4, "s" -> 4, "p" -> 2|> *)

Please visit the official Wolfram Language Reference for more details.

On this page