Combine Columns
Create a new column by combining other columns using a String Template. Use the String Template to manipulate text according to a specific pattern or structure. The $column_<column_name> notation can be used to specify any column in your dataset.
Parameters
- Destination Column: The column name that will hold the manipulated text. Defaults to
manipulated_text
. - String Template: The template that guides the manipulation of text. Defaults to empty string.
Usage
To use the Combine Columns transformation, you will need to follow these steps:
- Specify the Destination Column parameter with the name of the column that will hold the manipulated text.
- Define the String Template parameter with the desired template that guides the manipulation of text. Use $field_source_column to reference the source column and $column_<column_name> to reference other columns in your dataset.
- Run the transformation by clicking the Save and Run Transforms button.
Example 1: Structuring Customer Feedback
Suppose you have a dataset of customer feedback with the customer's name, email, and feedback text. You want to structure the feedback text to include the customer's name and email in the "structured_text" column.
ID | Name | Feedback | |
---|---|---|---|
1 | John | [email protected] | Great product! |
2 | Jane | [email protected] | I love the new design |
Parameters (YAML):
transform:
name: Combine Columns
parameters:
source_column: Feedback
destination_column: structured_text
string_template: "Customer Name: $column_Name, Email: $column_Email, Feedback: $field_source_column"
Expected Result Dataset:
ID | Name | Feedback | Structured_Text | |
---|---|---|---|---|
1 | John | [email protected] | Great product! | Customer Name: John, Email: [email protected], Feedback: Great product! |
2 | Jane | [email protected] | I love the new design | Customer Name: Jane, Email: [email protected], Feedback: I love the new design |
Example 2: Structuring Order Details
Suppose you have a dataset of order details with the order ID, product name, and quantity. You want to structure the order details into a sentence in the "structured_text" column.
Order_ID | Product_Name | Quantity |
---|---|---|
1001 | Laptop | 2 |
1002 | Headphones | 1 |
Parameters (YAML):
transform:
name: Combine Columns
parameters:
source_column: Product_Name
destination_column: structured_text
string_template: "Order ID: $column_Order_ID, Product: $field_source_column, Quantity: $column_Quantity"
Expected Result Dataset:
Order_ID | Product_Name | Quantity | Structured_Text |
---|---|---|---|
1001 | Laptop | 2 | Order ID: 1001, Product: Laptop, Quantity: 2 |
1002 | Headphones | 1 | Order ID: 1002, Product: Headphones, Quantity: 1 |
Updated over 1 year ago