ray.data.expressions.Expr.abs#

Expr.abs() UDFExpr[source]#

Compute the absolute value of the expression.

Returns:

A UDFExpr that computes the absolute value.

Example

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