datatable.math.abs()

Return the absolute value of x. This function can only be applied to numeric arguments (i.e. boolean, integer, or real).

This function upcasts columns of types bool8, int8 and int16 into int32; for columns of other types the stype is kept.

Parameters

x
FExpr

Column expression producing one or more numeric columns.

return
FExpr

The resulting FExpr evaluates absolute values in all elements in all columns of x.

Examples

DT = dt.Frame(A=[-3, 2, 4, -17, 0]) DT[:, abs(f.A)]
A
int32
03
12
24
317
40

See also