isPrefix function in the Factory

The isPrefix function checks whether a string is a prefix or not, and returns True in the rows of the column starting with the string value; otherwise the function returns False.


Parameters

isPrefix(column, value, binary)

If you are using continuous attributes, check the Flow Execution Parameters.

Parameter

Description

column

The nominal attribute in which the value will be checked. If it is not nominal, it will be casted to nominal upon function’s computation. The column parameter is mandatory.

value

The value to be checked in the column. If it is not nominal, it will be casted to nominal upon function’s computation. The value parameter is mandatory.

The value parameter is case sensitive.

binary

If it is True, or not specified, results will be provided as Booleans (True/False), while if it is False, results will be provided in binary form (1/0).


Example

The following example uses the HR-Employee-Attrition dataset.

Description

Screenshot

In this example, we want to identify if the string 'Travel' is a prefix for the values in the BusinessTravel attribute.

Add a new attribute, which we have called travel, and type the following formula:

isPrefix($"BusinessTravel",'Travel_')

The results are provided as Booleans, as we didn’t specify the binary parameter.