ray.data.Dataset.columns#

Dataset.columns(fetch_if_missing: bool = True) List[str] | None[source]#

Returns the columns of this Dataset.

Note

If this dataset consists of more than a read, or if the schema can’t be determined from the metadata provided by the datasource, or if fetch_if_missing=True (the default), then this operation will trigger execution of the lazy transformations performed on this dataset.

Time complexity: O(1)

Example

>>> import ray
>>> # Create dataset from synthetic data.
>>> ds = ray.data.range(1000)
>>> ds.columns()
['id']
Parameters:

fetch_if_missing – If True, synchronously fetch the column names from the schema if it’s not known. If False, None is returned if the schema is not known. Default is True.

Returns:

A list of the column names for this Dataset or None if schema is not known and fetch_if_missing is False.