Counter

Standard library class collections.Counter View source
class Counter
@tuple
class Counter[T]
Fields 1
T type
Constructors 5
__new__
__new__(capacity: int = 8)
Defined in collections
__new__
__new__(elements: Generator[T])
Defined in collections
__new__
__new__(other: Counter[T])
Defined in collections
__new__
__new__(other: OrderedDict[T, int])
Defined in collections
__new__
__new__(other: defaultdict[T, int, S], S: type)
Added by collections
Methods 17
keys
keys(self)
Defined in collections
values
values(self)
Defined in collections
items
items(self)
Defined in collections
get
get(self, key: T)
Defined in collections
get(self, key: T, default: int)
Defined in collections
setdefault
setdefault(self, key: T, value: int)
Defined in collections
pop
pop(self, key: T)
Defined in collections
pop(self, key: T, missing)
Defined in collections
popitem
popitem(self)
Defined in collections
clear
clear(self)
Defined in collections
resize
resize(self, minused: int)
Defined in collections
increment
increment(self, key: T, by: Z = 1, Z: type)
Defined in collections
copy
copy(self)
Defined in collections
fromkeys
fromkeys(ks: Generator[K], v: V, K: type, V: type)
Defined in collections
elements
elements(self)
Defined in collections
most_common
most_common(self, n: Optional[int] = None)
Defined in collections
subtract
subtract(self, elements: Generator[T])
Defined in collections
subtract(self, other: Counter[T])
Defined in collections
subtract(self, other: OrderedDict[T, int])
Defined in collections
subtract(self, other: defaultdict[T, int, S], S: type)
Added by collections
update
update(self, elements: Generator[T])
Defined in collections
update(self, other: Counter[T])
Defined in collections
update(self, other: OrderedDict[T, int])
Defined in collections
update(self)
Defined in collections
update(self, other: defaultdict[T, int, S], S: type)
Added by collections
total
total(self)
Defined in collections
Special methods 25
__len__
__len__(self)
Defined in collections
__bool__
__bool__(self)
Defined in collections
__iter__
__iter__(self)
Defined in collections
__reversed__
__reversed__(self)
Defined in collections
__contains__
__contains__(self, key: T)
Defined in collections
__setitem__
__setitem__(self, key: T, value: int)
Defined in collections
__deepcopy__
__deepcopy__(self)
Defined in collections
__getitem__
__getitem__(self, key: T)
Defined in collections
__delitem__
__delitem__(self, key: T)
Defined in collections
__eq__
__eq__(self, other: Counter[T])
Defined in collections
__eq__(self, other: OrderedDict[T, int])
Defined in collections
__eq__(self, other: defaultdict[T, int, S], S: type)
Added by collections
__ne__
__ne__(self, other: Counter[T])
Defined in collections
__ne__(self, other: OrderedDict[T, int])
Defined in collections
__ne__(self, other: defaultdict[T, int, S], S: type)
Added by collections
__copy__
__copy__(self)
Defined in collections
__or__
__or__(self, other)
Defined in collections
__or__(self, other: Counter[T])
Defined in collections
__ior__
__ior__(self, other)
Defined in collections
__ior__(self, other: Counter[T])
Defined in collections
__iadd__
__iadd__(self, other: Counter[T])
Defined in collections
__isub__
__isub__(self, other: Counter[T])
Defined in collections
__iand__
__iand__(self, other: Counter[T])
Defined in collections
__pos__
__pos__(self)
Defined in collections
__neg__
__neg__(self)
Defined in collections
__add__
__add__(self, other: Counter[T])
Defined in collections
__sub__
__sub__(self, other: Counter[T])
Defined in collections
__and__
__and__(self, other: Counter[T])
Defined in collections
__repr__
__repr__(self)
Defined in collections
__dict_do_op__
__dict_do_op__(self, key: T, other: Z, default: int, op: F, F: type, Z: type)
Defined in collections
__dict_do_op_throws__
__dict_do_op_throws__(self, key: T, other: Z, op: F, F: type, Z: type)
Defined in collections