map-column-values
Description
map-column-values
adaptor adds a new column to a datatable by mapping values of an existing column.
Inputs
data
Type: datatable
Required: Yes
The columns and rows.
original column
Type: text
Required: Yes
The name of an existing column containing values to be mapped.
values
Type: dictionary
Required: Yes
The map of existing and new values, where the keys are the existing values in the original column, and the values are the corresponding values to be written to the new column.
new column
Type: text
Required: No
The name of the new column to which the mapped values will be written. If unspecified, mapped values will be written to the original column.
case sensitive
Type: boolean
Required: No
Whether lowercase and uppercase letters should be treated as equivalent. If unspecified, defaults to False
(lowercase and uppercase letters are treated as equivalent).
unmapped values
Type: text
Required: No
Specifies what values to write in the new column when the original column values are not included as map keys. If unspecified, defaults to Replace original value with blank
.
Outputs
data
Type: datatable
A datatable containing mapped values in new column
.
Examples
Example 1: Default behaviour.
Inputs:
data
:
1
GB
United Kingdom
2
TR
Turkey
3
US
United States
4
IN
India
original column
: code
values:
GB
gb
TR
tr
US
us
IN
in
new column:
null (empty)
case sensitive:
null (empty)
unmapped values:
null (empty)
Outputs:
data
:
1
gb
United Kingdom
2
tr
Turkey
3
us
United States
4
in
India
-> Mapped values in the code
column, replacing existing values.
Example 2: Specify new column and unmapped values.
Inputs:
data
:
1
GB
United Kingdom
2
TR
Turkey
3
US
United States
4
IN
India
original column
: code
values:
GB
gb
TR
tr
US
us
new column:
country code
case sensitive:
null (empty)
unmapped values:
none
Outputs:
data
:
1
GB
United Kingdom
gb
2
TR
Turkey
tr
3
US
United States
us
4
IN
India
none
-> Mapped values in the code
column, creating a new column named country code
. Unmapped value was set to none.
Last updated