dataFrame.column.str — replace()

Description

The replace() method of the str object returns the values of the selected column after replacing matches of the specified search pattern.

Signature

dataFrame.column(columnName).str.replace(searchPattern, replacePattern)
Scope
dataFrame
Family
str
Returns
array

Argument

columnName (string)
The name of the column containing the values to transform.
searchPattern (string | regexp)
The pattern to search for.
replacePattern (string)
The replacement value.

Returns

mask ( string[] )
An array containing the transformed values.

Example

// replace patterns from the values of a column of the dataFrame
var mask = dataFrame.column('values').str.replace('cat', 'dog');

// add values to the dataFrame
dataFrame.column('newValues').set(mask);