find function in the Factory
The find function looks for a value within a column and returns True or False.
Parameters If you are using continuous attributes, check the Flow Execution Parameters. Parameter Description column The nominal attribute where the value will be searched. 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 searched 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). ischarlist If it is False, or not specified, only the value as a block will be considered, while if it is True, all the fonts in the value will be considered separately. charpos If it is =0, True is returned if the value is present in the column. If charpos is >0 the function returns in each row the position of the value within the column if it is present in it, otherwise the function returns an empty cell. Example The following example uses the Adult dataset. Description Screenshot In this example, we want to find the Bachelors value in the Education attribute. Add a new attribute, called find, and type the following formula: As we didn’t specify the binary and ischarlist parameters (we want to keep the default options), we needed to write The function returns a 1 when the Bachelors value is found, or an empty cell when the value is not present in the corresponding row.find(column, value, binary, ischarlist, charpos)
find($"education",'Bachelors',charpos=2)
charpos=2
. If the binary and ischarlist parameters would have been specified, we should have written only 2 in the formula.