ifNone function

The ifNone function fills the attribute’s None values, which satisfy the specified condition, with the desired value. If the condition is not satisfied, the cell is left empty.


Parameters

ifNone(column, condition, iftrue)

Parameter

Description

column

The attribute containing the None values. The column parameter is mandatory.

condition

The condition that must be satisfied to fill the column. The condition parameter is mandatory.

iftrue

The value which will fill the None values if the condition is satisfied. The iftrue parameter is mandatory.


Example

The following example uses a simple dataset we have created on our own, using an Empty Source task and filling the values randomply through a Data Manager task.

Description

Screenshot

In this example, we have the Var_3 attribute, which must contain the Var1 values plus the string 'B' replacing the None values if the values in Var_2 are above 3.

Select the Var_3 attribute and type the following formula: ifNone($"Var_1",$"Var_2">3,"B")

This is the final result. As you can see, in Var_3 attribute, row 4, a 'B' has been added, as in Var_1, row 4 the cell is None and in Var_2, row 4 the value is above 3.