ray.data.expressions.ColumnExpr.negate#

ColumnExpr.negate() UDFExpr#

Compute the negation of the expression.

Returns:

A UDFExpr that computes the negation (multiplies values by -1).

Example

>>> from ray.data.expressions import col
>>> import ray
>>> ds = ray.data.from_items([{"x": 5}, {"x": -3}])
>>> ds = ds.with_column("neg_x", col("x").negate())
>>> # Result: neg_x = [-5, 3]