Lines Matching defs:elements
524 'Tally elements from the iterable.'
539 >>> c = Counter('abcdeabcdabcaba') # count elements from a string
541 >>> c.most_common(3) # three most common elements
543 >>> sorted(c) # list all unique elements
545 >>> ''.join(sorted(c.elements())) # list elements with repetitions
586 '''Create a new, empty Counter object. And if given, count elements
588 of elements to their counts.
600 'The count of elements not in the Counter is zero.'
609 '''List the n most common elements and their counts from the most
624 def elements(self):
625 '''Iterator over elements repeating each as many times as its count.
628 >>> sorted(c.elements())
634 >>> math.prod(prime_factors.elements())
638 number, elements() will ignore it.
664 >>> c.update('witch') # add elements from another iterable
666 >>> c.update(d) # add elements from another counter
700 >>> c.subtract('witch') # subtract elements from another iterable
701 >>> c.subtract(Counter('watch')) # subtract elements from another counter
907 '''Internal method to strip elements with a negative or zero count'''