ray.data.expressions.uuid#

ray.data.expressions.uuid() UUIDExpr[source]#

Create a UUID expression that generates unique identifiers.

This creates an expression that generates unique identifiers (strings) for each row. The identifiers are generated using the UUID4 algorithm.

Returns:

A UUIDExpr that generates unique identifiers

Example

>>> from ray.data.expressions import uuid
>>> import ray
>>> ds = ray.data.range(10)
>>> ds.with_column("uuid", uuid().str.replace("-", "")).take(5)  
[{'id': 0, 'uuid': '2899f7bd87164b98a774df730a99c8b3'},
 {'id': 1, 'uuid': 'e398656a73b0475fb6d9d5d4389a23e6'},
 {'id': 2, 'uuid': '6ef8e2a18c6c4b7e8a4089b3fcfd8094'},
 {'id': 3, 'uuid': 'c4abbc54bc8947899ed3ab0bf1eaf75a'},
 {'id': 4, 'uuid': 'b6265f98e2d0431ea86d837e8a16d31c'}]

PublicAPI (alpha): This API is in alpha and may change before becoming stable.