Skip to main content

Compare Wrangles

Compare wrangles, with recipe examples, parameters, and behavior.

Lists​

Compare multiple lists and return the intersection, difference, or union.

Parameters​

NameDescriptionAccepted ValuesDefaultRequired
I/O
inputList of input columns containing lists to compare.array—Yes
outputName of the output column.string—Yes
Options
methodType of comparison to perform.string; one of:
  • intersection
  • difference
  • union
"intersection"No
remove_duplicatesRemove duplicates from the result.booleanfalseNo
ignore_caseIgnore case when comparing string items.booleanfalseNo
Conditions
ifCondition that determines whether the wrangle runs as a whole. Recipe variables may be referenced with ${variable}.string—No
whereFilter rows before applying the wrangle using SQL-like criteria, such as column1 = 123 OR column2 = 'abc'.string—No
where_paramsValues 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
Col1Col2
[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
Col1Col2
[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
Col1Col2
[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
RequirementValue
AI-poweredNo
Requires WrangleWorks accountNo
Requires subscriptionNo
Requires external API keyNo
Technical details
FieldValue
Catalog ID1
Catalog keycompare.lists
Recipe keycompare.lists
Catalog statusactive
Lifecycle statusactive
Recipe Writer eligibleYes
Namespacecompare
Documentation groupcompare
AliasesNone
Runtime symbolwrangles.recipe_wrangles.compare.lists
Legacy UUIDa393225e-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​

NameDescriptionAccepted ValuesDefaultRequired
I/O
inputThe columns to compare. First column is the base column.array—Yes
outputThe 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
methodThe type of comparison to perform (difference, intersection, overlap, similarity).string; one of:
  • difference
  • intersection
  • overlap
  • similarity
"difference"No
charCharacter to split strings on for difference and intersection. Defaults to a space.string" "No
exact_matchValue to use for exact matches when using overlap.string, nullnullNo
empty_aValue to use when input A is empty when using overlap.string, nullnullNo
empty_bValue to use when input B is empty when using overlap.string, nullnullNo
all_emptyValue to use when both inputs are empty when using overlap.string, nullnullNo
case_sensitiveWhether the comparison is case sensitive. Defaults to true.booleanfalseNo
metricMetric value accepted by the runtime.string"token_sort"No
Formatting
non_match_charCharacter to use for non-matching characters when using overlap.string"*"No
include_ratioInclude the ratio of matching characters when using overlap.booleanfalseNo
decimal_placesNumber of decimal places to round the overlap ratio to.integer3No
Conditions
ifCondition that determines whether the wrangle runs as a whole. Recipe variables may be referenced with ${variable}.string—No
whereFilter rows before applying the wrangle using SQL-like criteria, such as column1 = 123 OR column2 = 'abc'.string—No
where_paramsValues 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
Col1Col2
Large Oak Wood White Marble Top BookshelfLarge Pine Wood Black Marble Bottom Bookshelf
Medium Oak Wood White Marble Top Coffee TableMedium Maple Wood Orange Steel Top Coffee Table
Small Oak Wood White Marble Top Console TableSmall 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
Col1Col2
Large Oak Wood White Marble Top BookshelfLarge Pine Wood Black Marble Bottom Bookshelf
Medium Oak Wood White Marble Top Coffee TableMedium Maple Wood Orange Steel Top Coffee Table
Small Oak Wood White Marble Top Console TableSmall 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 Code1Part Code2
SKF6202TMKN6202
X06-02-000X06-81-000
7100E15-V-230/37100E15-V-120/1
Overlap
****6202
X06-**-000
7100E15-V-**0/*
Access
RequirementValue
AI-poweredNo
Requires WrangleWorks accountNo
Requires subscriptionNo
Requires external API keyNo
Technical details
FieldValue
Catalog ID2
Catalog keycompare.text
Recipe keycompare.text
Catalog statusactive
Lifecycle statusactive
Recipe Writer eligibleYes
Namespacecompare
Documentation groupcompare
AliasesNone
Runtime symbolwrangles.recipe_wrangles.compare.text
Legacy UUID31905b74-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​

NameDescriptionAccepted ValuesDefaultRequired
I/O
inputTwo columns of vectors to compare the similarity of.array—Yes
outputName of the output column.string—Yes
Options
methodThe 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
  • adjusted cosine
  • euclidean
"cosine"No
Conditions
ifCondition that determines whether the wrangle runs as a whole. Recipe variables may be referenced with ${variable}.string—No
whereFilter rows before applying the wrangle using SQL-like criteria, such as column1 = 123 OR column2 = 'abc'.string—No
where_paramsValues 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
col1col2
SKFTimken
Ball BearingRoller Bearing
col1 embeddingscol2 embeddingssimilarity
[1, 2, 3, 4][4, 3, 2, 1]0.158931
[5, 6, 7, 8][5, 6, 7, 9]0.942437
Access
RequirementValue
AI-poweredNo
Requires WrangleWorks accountNo
Requires subscriptionNo
Requires external API keyNo
Technical details
FieldValue
Catalog ID92
Catalog keysimilarity
Recipe keysimilarity
Catalog statusactive
Lifecycle statusactive
Recipe Writer eligibleYes
NamespaceRoot-level
Documentation groupcompare
AliasesNone
Runtime symbolwrangles.recipe_wrangles.main.similarity
Legacy UUID7c733344-4cce-4938-8013-53742fb46a90

Sources