ray.data.Dataset.min#

Dataset.min(on: Optional[Union[str, List[str]]] = None, ignore_nulls: bool = True) Union[Any, Dict[str, Any]][source]#

Return the minimum of one or more columns.

Note

This operation will trigger execution of the lazy transformations performed on this dataset.

Examples

>>> import ray
>>> ray.data.range(100).min("id")
0
>>> ray.data.from_items([
...     {"A": i, "B": i**2}
...     for i in range(100)
... ]).min(["A", "B"])
{'min(A)': 0, 'min(B)': 0}
Parameters
  • on – a column name or a list of column names to aggregate.

  • ignore_nulls – Whether to ignore null values. If True, null values are ignored when computing the min; if False, when a null value is encountered, the output is None. This method considers np.nan, None, and pd.NaT to be null values. Default is True.

Returns

The min result.

For different values of on, the return varies:

  • on=None: an dict containing the column-wise min of all columns,

  • on="col": a scalar representing the min of all items in column "col",

  • on=["col_1", ..., "col_n"]: an n-column dict containing the column-wise min of the provided columns.

If the dataset is empty, all values are null. If ignore_nulls is False and any value is null, then the output is None.