Compare Wrangles
Compare wrangles, with recipe examples, parameters, and behavior.
Lists
Compare multiple lists and return the intersection, difference, or union.
Parameters
| Name | Description | Accepted Values | Default | Required |
|---|---|---|---|---|
| I/O | ||||
input | List of input columns containing lists to compare. | array | — | Yes |
output | Name of the output column. | string | — | Yes |
| Options | ||||
method | Type of comparison to perform. | string; one of:
| "intersection" | No |
remove_duplicates | Remove duplicates from the result. | boolean | false | No |
ignore_case | Ignore case when comparing string items. | boolean | false | No |
| Conditions | ||||
if | Condition that determines whether the wrangle runs as a whole. Recipe variables may be referenced with ${variable}. | string | — | No |
where | Filter rows before applying the wrangle using SQL-like criteria, such as column1 = 123 OR column2 = 'abc'. | string | — | No |
where_params | Values used with where for parameterized criteria. Uses SQLite placeholder syntax such as ? or :name. | array, object | — | No |
Examples
wrangles:
- compare.lists:
input:
- col1
- col2
output: Difference
method: difference
| Col1 | Col2 |
|---|---|
| [A, B, C] | [C, D, E] |
| [H, I, J, K] | [H, I, J] |
| [X, Y, Z] | [1, 2, 3] |
| Difference |
|---|
| [A, B] |
| [K] |
| [X, Y, Z] |
wrangles:
- compare.lists:
input:
- col1
- col2
output: Intersection
method: intersection
| Col1 | Col2 |
|---|---|
| [A, B, C] | [C, D, E] |
| [H, I, J, K] | [H, I, J] |
| [X, Y, Z] | [1, 2, 3] |
| Intersection |
|---|
| [C] |
| [H, I, J] |
| [] |
wrangles:
- compare.lists:
input:
- col1
- col2
output: Union
method: union
| Col1 | Col2 |
|---|---|
| [A, B, C] | [C, D, E] |
| [H, I, J, K] | [H, I, J] |
| [X, Y, Z] | [1, 2, 3] |
| Union |
|---|
| [A, B, C, D, E] |
| [H, I, J, K] |
| [X, Y, Z, 1, 2, 3] |
Access
| Requirement | Value |
|---|---|
| AI-powered | No |
| Requires WrangleWorks account | No |
| Requires subscription | No |
| Requires external API key | No |
Technical details
| Field | Value |
|---|---|
| Catalog ID | 1 |
| Catalog key | compare.lists |
| Recipe key | compare.lists |
| Catalog status | active |
| Lifecycle status | active |
| Recipe Writer eligible | Yes |
| Namespace | compare |
| Documentation group | compare |
| Aliases | None |
| Runtime symbol | wrangles.recipe_wrangles.compare.lists |
| Legacy UUID | a393225e-7ccf-4708-83f8-d5abd6ba9b1e |
Sources
Text
Compare two strings and return the intersection or difference, use overlap to find the matching characters between the two strings, or use similarity to get a numeric similarity score.
Compare two strings and return the intersection or difference, or use overlap to find the matching characters between the two strings.
Parameters
| Name | Description | Accepted Values | Default | Required |
|---|---|---|---|---|
| I/O | ||||
input | The columns to compare. First column is the base column. | array | — | Yes |
output | The column to output the results to. Must be a list of two column names [mask_column, ratio_column] when method is overlap and include_ratio is true; otherwise a single column name. | string, array | — | Yes |
| Options | ||||
method | The type of comparison to perform (difference, intersection, overlap, similarity). | string; one of:
| "difference" | No |
char | Character to split strings on for difference and intersection. Defaults to a space. | string | " " | No |
exact_match | Value to use for exact matches when using overlap. | string, null | null | No |
empty_a | Value to use when input A is empty when using overlap. | string, null | null | No |
empty_b | Value to use when input B is empty when using overlap. | string, null | null | No |
all_empty | Value to use when both inputs are empty when using overlap. | string, null | null | No |
case_sensitive | Whether the comparison is case sensitive. Defaults to true. | boolean | false | No |
metric | Metric value accepted by the runtime. | string | "token_sort" | No |
| Formatting | ||||
non_match_char | Character to use for non-matching characters when using overlap. | string | "*" | No |
include_ratio | Include the ratio of matching characters when using overlap. | boolean | false | No |
decimal_places | Number of decimal places to round the overlap ratio to. | integer | 3 | No |
| Conditions | ||||
if | Condition that determines whether the wrangle runs as a whole. Recipe variables may be referenced with ${variable}. | string | — | No |
where | Filter rows before applying the wrangle using SQL-like criteria, such as column1 = 123 OR column2 = 'abc'. | string | — | No |
where_params | Values used with where for parameterized criteria. Uses SQLite placeholder syntax such as ? or :name. | array, object | — | No |
Examples
wrangles:
- compare.text:
input:
- col1
- col2
output: Difference
method: difference
| Col1 | Col2 |
|---|---|
| Large Oak Wood White Marble Top Bookshelf | Large Pine Wood Black Marble Bottom Bookshelf |
| Medium Oak Wood White Marble Top Coffee Table | Medium Maple Wood Orange Steel Top Coffee Table |
| Small Oak Wood White Marble Top Console Table | Small Normal Wood Blue Plastic Top Console Table |
| Difference |
|---|
| Pine Black Bottom |
| Maple Orange Steel |
| Normal Blue Plastic |
wrangles:
- compare.text:
input:
- col1
- col2
output: Intersection
method: intersection
| Col1 | Col2 |
|---|---|
| Large Oak Wood White Marble Top Bookshelf | Large Pine Wood Black Marble Bottom Bookshelf |
| Medium Oak Wood White Marble Top Coffee Table | Medium Maple Wood Orange Steel Top Coffee Table |
| Small Oak Wood White Marble Top Console Table | Small Normal Wood Blue Plastic Top Console Table |
| Intersection |
|---|
| Large Wood Marble Bookshelf |
| Medium Wood Top Coffee Table |
| Small Wood Top Console Table |
wrangles:
- compare.text:
input:
- Part Code1
- Part Code2
output: Overlap
method: overlap
| Part Code1 | Part Code2 |
|---|---|
| SKF6202 | TMKN6202 |
| X06-02-000 | X06-81-000 |
| 7100E15-V-230/3 | 7100E15-V-120/1 |
| Overlap |
|---|
| ****6202 |
| X06-**-000 |
| 7100E15-V-**0/* |
Access
| Requirement | Value |
|---|---|
| AI-powered | No |
| Requires WrangleWorks account | No |
| Requires subscription | No |
| Requires external API key | No |
Technical details
| Field | Value |
|---|---|
| Catalog ID | 2 |
| Catalog key | compare.text |
| Recipe key | compare.text |
| Catalog status | active |
| Lifecycle status | active |
| Recipe Writer eligible | Yes |
| Namespace | compare |
| Documentation group | compare |
| Aliases | None |
| Runtime symbol | wrangles.recipe_wrangles.compare.text |
| Legacy UUID | 31905b74-ce58-45cd-8add-821cc04ab946 |
Sources
Similarity
Calculate the cosine similarity of two vectors.
Calculate the similarity of two vectors.
info
Similarity only works on vectors. To produce vectors from a column of strings, use create.embeddings first.
Parameters
| Name | Description | Accepted Values | Default | Required |
|---|---|---|---|---|
| I/O | ||||
input | Two columns of vectors to compare the similarity of. | array | — | Yes |
output | Name of the output column. | string | — | Yes |
| Options | ||||
method | The type of similarity to calculate (cosine or euclidean). Adjusted cosine adjusts the default cosine calculation to cover a range of 0-1 for typical comparisons. | string; one of:
| "cosine" | No |
| Conditions | ||||
if | Condition that determines whether the wrangle runs as a whole. Recipe variables may be referenced with ${variable}. | string | — | No |
where | Filter rows before applying the wrangle using SQL-like criteria, such as column1 = 123 OR column2 = 'abc'. | string | — | No |
where_params | Values used with where for parameterized criteria. Uses SQLite placeholder syntax such as ? or :name. | array, object | — | No |
Examples
wrangles:
- create.embeddings:
input: col1
api_key: ${my_key}
output: col1 embeddings
- create.embeddings:
input: col2
api_key: ${my_key}
output: col2 embeddings
- similarity:
input:
- col1 embeddings
- col2 embeddings
output: similarity
method: adjusted cosine
| col1 | col2 |
|---|---|
| SKF | Timken |
| Ball Bearing | Roller Bearing |
| col1 embeddings | col2 embeddings | similarity |
|---|---|---|
| [1, 2, 3, 4] | [4, 3, 2, 1] | 0.158931 |
| [5, 6, 7, 8] | [5, 6, 7, 9] | 0.942437 |
Access
| Requirement | Value |
|---|---|
| AI-powered | No |
| Requires WrangleWorks account | No |
| Requires subscription | No |
| Requires external API key | No |
Technical details
| Field | Value |
|---|---|
| Catalog ID | 92 |
| Catalog key | similarity |
| Recipe key | similarity |
| Catalog status | active |
| Lifecycle status | active |
| Recipe Writer eligible | Yes |
| Namespace | Root-level |
| Documentation group | compare |
| Aliases | None |
| Runtime symbol | wrangles.recipe_wrangles.main.similarity |
| Legacy UUID | 7c733344-4cce-4938-8013-53742fb46a90 |
Sources