abs function

The abs function returns the absolute value of each value of the column.


Parameters

abs(column)

Parameter

Description

column

The attribute used to evaluate its absolute value. Its type must be numeral. The column parameter is mandatory.


Example

The following example uses the Top Hits Spotify dataset.

This example isn’t based on a real scenario, it only explains how to use the function.

Description

Screenshot

In this example, we want to convert the loudness attribute’s values to their absolute value.

Add a new column to the dataset and type the following formula:

abs($"loudness")

As you can see, the column has been filled with the absolute value of the loudness attribute.