Counts[list]
gives an association whose keys are the distinct elements of list, and whose values give the number of times those elements appear in list.
Counts[list,elems]
gives an association whose keys are the distinct elements in elems, and whose values give the number of times those elements appear in list.


Counts

Counts[list]
gives an association whose keys are the distinct elements of list, and whose values give the number of times those elements appear in list.
Counts[list,elems]
gives an association whose keys are the distinct elements in elems, and whose values give the number of times those elements appear in list.
Examples
open all close allBasic Examples (2)
Scope (1)
Properties & Relations (5)
Counts[list] lists elements by the order in which the first appear in list:
Counts[list,elems] lists elements by the order in which the first appear in elems:
Counts[list,elems] will contain totals for all elements in elems, even if they do not appear in list:
CountsBy[list,f] is effectively Counts[Map[f,list]]:
Counts examines literal values:
Count tallies elements matching a pattern:
See Also
CountsBy Tally BinCounts Merge GroupBy Count Gather Commonest DuplicateFreeQ KeySort Sort CharacterCounts WordCounts WordCloud
Function Repository: ItemCounts Proportions Duplicates
Text
Wolfram Research (2014), Counts, Wolfram Language function, https://reference.wolfram.com/language/ref/Counts.html (updated 2025).
CMS
Wolfram Language. 2014. "Counts." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/Counts.html.
APA
Wolfram Language. (2014). Counts. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Counts.html
BibTeX
@misc{reference.wolfram_2025_counts, author="Wolfram Research", title="{Counts}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/Counts.html}", note=[Accessed: 15-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_counts, organization={Wolfram Research}, title={Counts}, year={2025}, url={https://reference.wolfram.com/language/ref/Counts.html}, note=[Accessed: 15-August-2025]}