Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python counter least common

import collections
c = collections.Counter(a=1, b=2, c=3)
n = 2

print c.most_common()[:-n-1:-1]Output[('a', 1), ('b', 2)]
Source by kite.com #
 
PREVIOUS NEXT
Tagged: #python #counter #common
ADD COMMENT
Topic
Name
4+2 =