MCPcopy
hub / github.com/ray-project/ray / columns

Method columns

python/ray/data/dataset.py:4194–4219  ·  view source on GitHub ↗

Returns the columns of this Dataset. Time complexity: O(1) Example: >>> import ray >>> # Create dataset from synthetic data. >>> ds = ray.data.range(1000) >>> ds.columns() ['id'] Args: fetch_if_missing

(self, fetch_if_missing: bool = True)

Source from the content-addressed store, hash-verified

4192 )
4193 @PublicAPI(api_group=IM_API_GROUP)
4194 def columns(self, fetch_if_missing: bool = True) -> Optional[List[str]]:
4195 """Returns the columns of this Dataset.
4196
4197 Time complexity: O(1)
4198
4199 Example:
4200 >>> import ray
4201 >>> # Create dataset from synthetic data.
4202 >>> ds = ray.data.range(1000)
4203 >>> ds.columns()
4204 ['id']
4205
4206 Args:
4207 fetch_if_missing: If True, synchronously fetch the column names from the
4208 schema if it's not known. If False, None is returned if the schema is
4209 not known. Default is True.
4210
4211 Returns:
4212 A list of the column names for this Dataset or None if schema is not known
4213 and `fetch_if_missing` is False.
4214
4215 """
4216 schema = self.schema(fetch_if_missing=fetch_if_missing)
4217 if schema is not None:
4218 return schema.names
4219 return None
4220
4221 @PublicAPI(api_group=IM_API_GROUP)
4222 def num_blocks(self) -> int:

Callers 3

verify_schemaFunction · 0.45
test_state_schemaFunction · 0.45
train_preprocessorFunction · 0.45

Calls 1

schemaMethod · 0.95

Tested by 2

verify_schemaFunction · 0.36
test_state_schemaFunction · 0.36