CountDistinct

CountDistinct[list]

gives the number of distinct elements that appear in list.

Details

  • CountDistinct[<|key1val1,key2val2,|>] gives the number of distinct vali.

Examples

open allclose all

Basic Examples  (2)

Count distinct elements in a list:

Count distinct values in an association:

Applications  (1)

Count the number of distinct characters that occur in a string:

Properties & Relations  (1)

CountDistinct[list] is equivalent to Length[DeleteDuplicates[list]]:

Introduced in 2014
 (10.0)