strip function

The strip function returns the value without the specified characters or list of characters located at the beginning, at the end or on both sides of the value.


Parameters

strip(column, value, where, ischarlist)

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

Parameter

Description

column

The nominal attribute containing the original values. If it is not nominal, it will be casted to nominal upon function’s computation. The column parameter is mandatory.

value

The value containing the string or the list of characters to be removed. 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.

where

If it is begin, or not specified, the value will be removed from the beginning of the word.

If it is end, the value will be removed at the end of the word.

If it is both, the value will be removed both at the end and the beginning of the word.

ischarlist

If it is False, or not specified, only the value as a block will be considered, while if it is True, all the characters in the value will be considered separately.


Example

The following example uses the Adult dataset.

Description

Screenshot

In this example, we want to cancel the ‘S' not only as a block, but also as a list of characters from the occupation attribute.

Add a new attribute, which we will call strip, and type the following formula:

strip($"occupation",'S',ischarlist=True)

As we didn’t specify the where parameter, we needed to specify the parameter name in the formula.