counter#

class counter(iterable=None, /, **kwds)[source]#

Bases: Counter

Like collections.Counter, but with additional supported mathematical operations.

sc.counter has an “array” property, which converts the values to a NumPy array; methods not available to a Counter object are performed on the array instead.

Examples:

vals = [1,1,12,3,4,2,4,2,53,5,5,6,2,3,5]
counts = sc.counter(vals)
counts.max() # returns 3
New in version 3.2.3.

Attributes

array

NumPy array of values

Methods

property array#

NumPy array of values