Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

sort by the frequency of occurrences in Python

from collections import Counter
print [item for items, c in Counter(a).most_common() for item in [items] * c]
# [5, 5, 5, 5, 3, 3, 3, 4, 4, 4, 1, 1, 2]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sort #frequency #occurrences #Python
ADD COMMENT
Topic
Name
2+6 =