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]]:

Wolfram Research (2014), CountDistinct, Wolfram Language function, https://reference.wolfram.com/language/ref/CountDistinct.html.

Text

Wolfram Research (2014), CountDistinct, Wolfram Language function, https://reference.wolfram.com/language/ref/CountDistinct.html.

CMS

Wolfram Language. 2014. "CountDistinct." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CountDistinct.html.

APA

Wolfram Language. (2014). CountDistinct. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CountDistinct.html

BibTeX

@misc{reference.wolfram_2023_countdistinct, author="Wolfram Research", title="{CountDistinct}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/CountDistinct.html}", note=[Accessed: 02-October-2023 ]}

BibLaTeX

@online{reference.wolfram_2023_countdistinct, organization={Wolfram Research}, title={CountDistinct}, year={2014}, url={https://reference.wolfram.com/language/ref/CountDistinct.html}, note=[Accessed: 02-October-2023 ]}