ray.data.Dataset.count#
- Dataset.count() int [source]#
Count the number of rows in the dataset.
For Datasets which only read Parquet files (created with
read_parquet()
), this method reads the file metadata to efficiently count the number of rows without reading in the entire data.Note
If this dataset consists of more than a read, or if the row count can’t be determined from the metadata provided by the datasource, then this operation will trigger execution of the lazy transformations performed on this dataset.
Examples
>>> import ray >>> ds = ray.data.range(10) >>> ds.count() 10
- Returns:
The number of records in the dataset.