ray.data.Dataset.aggregate
ray.data.Dataset.aggregate#
- Dataset.aggregate(*aggs: ray.data.aggregate.AggregateFn) Union[Any, Dict[str, Any]] [source]#
Aggregate the entire dataset as one group.
Note
This operation will trigger execution of the lazy transformations performed on this dataset.
Examples
>>> import ray >>> from ray.data.aggregate import Max, Mean >>> ray.data.range(100).aggregate(Max("id"), Mean("id")) {'max(id)': 99, 'mean(id)': 49.5}
Time complexity: O(dataset size / parallelism)
- Parameters
aggs – Aggregations to do.
- Returns
If the input dataset is a simple dataset then the output is a tuple of
(agg1, agg2, ...)
where each tuple element is the corresponding aggregation result. If the input dataset is an Arrow dataset then the output is an dict where each column is the corresponding aggregation result. If the dataset is empty, returnNone
.