ray.data.grouped_dataset.GroupedDataset.count#

GroupedDataset.count() ray.data.dataset.Dataset[ray.data.block.U][source]#

Compute count aggregation.

This is a blocking operation.

Examples

>>> import ray
>>> ray.data.range(100).groupby(lambda x: x % 3).count() 
>>> ray.data.from_items([ 
...     {"A": x % 3, "B": x} for x in range(100)]).groupby( 
...     "A").count() 
Returns

A simple dataset of (k, v) pairs or an Arrow dataset of [k, v] columns where k is the groupby key and v is the number of rows with that key. If groupby key is None then the key part of return is omitted.