This function enables the replacement of specified values in a column with new ones. It takes a mapping object, where each key-value pair represents an “old value” -> “new value” transformation. The function scans the column for values that match any of the keys in the mapping object and replaces them with their corresponding new values. This function is case-sensitive and performs exact matches. For numeric replacements, it’s important to note that keys in the mapping object need to be strings, even for numeric columns. The function will internally convert these keys into numbers for comparison.Documentation Index
Fetch the complete documentation index at: https://docs.graphext.com/llms.txt
Use this file to discover all available pages before exploring further.
Usage
The following examples show how the step can be used in a recipe.Examples
Examples
- Example 1
- Example 2
- Example 3
- Example 4
- Example 5
- Signature
To change specific names in a column of texts from “pedro” to “pablo” and “maria” to “mariana”:
Inputs & Outputs
The following are the inputs expected by the step and the outputs it produces. These are generally columns (ds.first_name), datasets (ds or ds[["first_name", "last_name"]]) or models (referenced
by name e.g. "churn-clf").
Inputs
Inputs
A column containing text-like values.
Outputs
Outputs
The output column’s data type will depend on the input and specified parameters:
text: if input is text and parameter"as_category": falsecategory: if input is not a column of lists and"as_category": truelist: if input is a column of lists,listof the same kind as the input.
Configuration
The following parameters can be used to configure the behaviour of the step by including them in a json object as the last “input” to the step, i.e.step(..., {"param": "value", ...}) -> (output).
Parameters
Parameters
One or more additional parameters.