sign function

The sign function returns the sign of each value of the column.

  • -1 is returned if the value is negative, while

  • 1 is returned if the value is positive.


Parameters

sign(column)

Parameter

Description

column

The attribute used to evaluate the sign. Its type must be numeral or nominal. The column parameter is mandatory.


Example

The following example uses the Top hits Spotify dataset.

Description

Screenshot

In this example, we want to retrieve the sign of the loudness attribute.

Add a new attribute and type the following formula: sign($"loudness")

  • 1 is returned if the loudness value sign in the same row is positive, while

  • -1 is returned if the loudness value sign in the same row is negative