ray.data.Dataset.iter_rows#

Dataset.iter_rows(*, prefetch_blocks: int = 0) Iterator[Union[ray.data.block.T, ray.data.row.TableRow]][source]#

Return a local row iterator over the dataset.

If the dataset is a tabular dataset (Arrow/Pandas blocks), dict-like mappings TableRow are yielded for each row by the iterator. If the dataset is not tabular, the raw row is yielded.

Note

This operation will trigger execution of the lazy transformations performed on this dataset, and will block until execution completes.

Examples

>>> import ray
>>> for i in ray.data.range(1000000).iter_rows(): 
...     print(i) 

Time complexity: O(1)

Parameters

prefetch_blocks – The number of blocks to prefetch ahead of the current block during the scan.

Returns

A local iterator over the entire dataset.