ray.data.Dataset.iter_rows#

Dataset.iter_rows(*, prefetch_batches: int = 1, prefetch_blocks: int = 0) Iterable[Dict[str, Any]][source]#

Return an iterable over the rows in this dataset.

Note

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

Examples

>>> import ray
>>> for row in ray.data.range(3).iter_rows():
...     print(row)
{'id': 0}
{'id': 1}
{'id': 2}

Time complexity: O(1)

Parameters:
  • prefetch_batches – The number of batches to prefetch ahead of the current batch during the scan.

  • prefetch_blocks – This argument is deprecated. Use prefetch_batches instead.

Returns:

An iterable over the rows in this dataset.