MCPcopy Index your code
hub / github.com/ray-project/ray / max

Method max

python/ray/data/grouped_data.py:477–513  ·  view source on GitHub ↗

r"""Compute grouped max aggregation. Examples: >>> import ray >>> ray.data.le(100).groupby("value").max() # doctest: +SKIP >>> ray.data.from_items([ # doctest: +SKIP ... {"A": i % 3, "B": i, "C": i**2} # doctest: +SKIP ...

(
        self, on: Union[str, List[str]] = None, ignore_nulls: bool = True
    )

Source from the content-addressed store, hash-verified

475
476 @PublicAPI(api_group=CDS_API_GROUP)
477 def max(
478 self, on: Union[str, List[str]] = None, ignore_nulls: bool = True
479 ) -> Dataset:
480 r"""Compute grouped max aggregation.
481
482 Examples:
483 >>> import ray
484 >>> ray.data.le(100).groupby("value").max() # doctest: +SKIP
485 >>> ray.data.from_items([ # doctest: +SKIP
486 ... {"A": i % 3, "B": i, "C": i**2} # doctest: +SKIP
487 ... for i in range(100)]) # doctest: +SKIP
488 ... .groupby("A") # doctest: +SKIP
489 ... .max(["B", "C"]) # doctest: +SKIP
490
491 Args:
492 on: a column name or a list of column names to aggregate.
493 ignore_nulls: Whether to ignore null values. If ``True``, null
494 values will be ignored when computing the max; if ``False``,
495 if a null value is encountered, the output will be null.
496 We consider np.nan, None, and pd.NaT to be null values.
497 Default is ``True``.
498
499 Returns:
500 The max result.
501
502 For different values of ``on``, the return varies:
503
504 - ``on=None``: a dataset containing a groupby key column,
505 ``"k"``, and a column-wise max column for each original column in
506 the dataset.
507 - ``on=["col_1", ..., "col_n"]``: a dataset of ``n + 1``
508 columns where the first column is the groupby key and the second
509 through ``n + 1`` columns are the results of the aggregations.
510
511 If groupby key is ``None`` then the key part of return is omitted.
512 """
513 return self._aggregate_on(Max, on, ignore_nulls=ignore_nulls)
514
515 @PublicAPI(api_group=CDS_API_GROUP)
516 def mean(

Callers

nothing calls this directly

Calls 1

_aggregate_onMethod · 0.95

Tested by

no test coverage detected