MCPcopy
hub / github.com/ray-project/ray / aggregate

Method aggregate

python/ray/data/grouped_data.py:53–73  ·  view source on GitHub ↗

Implements an accumulator-based aggregation. Args: aggs: Aggregations to do. Returns: The output is an dataset of ``n + 1`` columns where the first column is the groupby key and the second through ``n + 1`` columns are the results of

(self, *aggs: AggregateFn)

Source from the content-addressed store, hash-verified

51
52 @PublicAPI(api_group=FA_API_GROUP)
53 def aggregate(self, *aggs: AggregateFn) -> Dataset:
54 """Implements an accumulator-based aggregation.
55
56 Args:
57 aggs: Aggregations to do.
58
59 Returns:
60 The output is an dataset of ``n + 1`` columns where the first column
61 is the groupby key and the second through ``n + 1`` columns are the
62 results of the aggregations.
63 If groupby key is ``None`` then the key part of return is omitted.
64 """
65
66 op = Aggregate(
67 key=self._key,
68 aggs=aggs,
69 input_dependencies=[self._dataset._logical_plan.dag],
70 num_partitions=self._num_partitions,
71 )
72 logical_plan = LogicalPlan(op, self._dataset.context)
73 return Dataset._from_parent(self._dataset, logical_plan)
74
75 def _aggregate_on(
76 self,

Callers 2

_aggregate_onMethod · 0.95
countMethod · 0.95

Calls 3

AggregateClass · 0.90
LogicalPlanClass · 0.90
_from_parentMethod · 0.80

Tested by

no test coverage detected