dask.bag.Bag.frequencies

dask.bag.Bag.frequencies

Bag.frequencies(split_every=None, sort=False)[源代码]

统计每个不同元素的出现次数。

>>> import dask.bag as db
>>> b = db.from_sequence(['Alice', 'Bob', 'Alice'])
>>> dict(b.frequencies())       
{'Alice': 2, 'Bob', 1}