Compute wrangles, with recipe examples, parameters, and behavior.
Case When | compute.case_when
Assign values to a column based on conditional logic.
Parameters
Name Description Accepted Values Default Required I/O outputName of the output column. string — Yes Options casesList of conditions and corresponding values. array — Yes defaultValue to assign if no conditions are met. Default None. string, number, integer, boolean, null nullNo 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 : - compute.case_when : output : Letter Grade cases : - condition : Grade > 89 value : 'A' - condition : 90 > Grade > 79 value : 'B' - condition : 80 > Grade > 69 value : 'C' - condition : 70 > Grade value : 'F'
Conditions can be combined so multiple criteria must be met before assigning a value.
wrangles : - compute.case_when : output : Letter Grade cases : - condition : (Grade > .89) & (Attendance == 'Good') value : 'A' - condition : (.90 > Grade > .79) & (Attendance == 'Good') value : 'B' - condition : (.80 > Grade > .69) & (Attendance == 'Good') value : 'C' - condition : (.70 > Grade) or (Attendance == 'Poor') value : 'F'
Access Requirement Value AI-powered No Requires WrangleWorks account No Requires subscription No Requires external API key No
Technical details Field Value Catalog ID 3Catalog key compute.case_whenRecipe key compute.case_whenCatalog status active Lifecycle status active Recipe Writer eligible Yes Namespace computeDocumentation group computeAliases None Runtime symbol wrangles.recipe_wrangles.compute.case_whenLegacy UUID 9a9662e4-53d1-4932-8adf-bc3e7aa364ad
Sources
Score Search Results | compute.score_search_results
Scores and filters search results based on progressive partial/exact matching. Can return dictionaries or a parallel list of formatted strings.
Parameters
Name Description Accepted Values Default Required I/O inputList of 3 to 5 columns -> [results, suppliers, part_codes, mpns (optional), descriptions (optional)]. array — Yes outputOutput column for the dictionaries. If a list of 2 is provided, outputs [dicts_column, pretty_strings_column]. string, array — Yes Options must_match_part_codeIf true, filters out results that don't satisfy the allowed match types. boolean trueNo allow_mpn_exactTreat exact MPN matches as valid part code matches. boolean trueNo allow_mpn_partialTreat partial MPN matches as valid part code matches. boolean trueNo allow_other_exactTreat exact other part code matches as valid part code matches. boolean trueNo allow_other_partialTreat partial other part code matches as valid part code matches. boolean trueNo blacklist_keywordsComma-separated list or array of keywords to filter out URLs containing them. string ""No mpn_exact_scoreMpn Exact Score value accepted by the runtime. number 8No mpn_partial_baseMpn Partial Base value accepted by the runtime. number 4No part_code_exact_scorePart Code Exact Score value accepted by the runtime. number 6No part_code_partial_basePart Code Partial Base value accepted by the runtime. number 2No supplier_exact_scoreSupplier Exact Score value accepted by the runtime. number 3No supplier_partial_baseSupplier Partial Base value accepted by the runtime. number 1No context_match_baseContext Match Base value accepted by the runtime. number 2No fuzzy_match_thresholdFuzzy Match Threshold value accepted by the runtime. number 0.8No 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
This template scores search results using supplier and part-code context. The fields added to each result dictionary depend on the scoring configuration.
wrangles : - compute.score_search_results : input : - Search Results - Suppliers - Part Codes output : - Scored Results allow_other_exact : true must_match_part_code : true
Scored Results Ranked result dictionaries
Template based on the documented parameters; no published source example is currently available.
Access Requirement Value AI-powered No Requires WrangleWorks account No Requires subscription No Requires external API key No
Technical details Field Value Catalog ID 4Catalog key compute.score_search_resultsRecipe key compute.score_search_resultsCatalog status active Lifecycle status active Recipe Writer eligible Yes Namespace computeDocumentation group computeAliases None Runtime symbol wrangles.recipe_wrangles.compute.score_search_resultsLegacy UUID 313a8ec0-cf13-4956-8d3b-5362b8641d0f
Sources
Math | math
Apply a mathematical calculation.
Apply mathematical calculations to columns. Also called as maths.
Spaces within column headers are replaced with underscores automatically. Account for this when writing expressions in input.
Parameters
Name Description Accepted Values Default Required I/O inputThe mathematical expression using column names. e.g. column1 * column2 + column3. Note: spaces within column names are replaced by underscores (_). string — Yes outputThe column to output the results to. string — Yes 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 : - math : input : sqrt(Values) output : Square Root
Access Requirement Value AI-powered No Requires WrangleWorks account No Requires subscription No Requires external API key No
Technical details Field Value Catalog ID 82Catalog key mathRecipe key mathCatalog status active Lifecycle status active Recipe Writer eligible Yes Namespace Root-level Documentation group computeAliases None Runtime symbol wrangles.recipe_wrangles.main.mathLegacy UUID 494b11ad-00c1-4748-8b93-6bec982f4fec
Sources
Python | python
Apply a simple single-line python command. For more complex python use a custom function. Note, this evaluates the python command - be especially cautious including variables from untrusted sources within the command string. The python command will be evaluated once for each row and the result returned. Reference column values by using their name. Non-alphanumeric characters within column names are replaced by underscores (_) Additionally, all columns are available as a dict named kwargs. Additional parameters set for the wrangle will also be available to the command.
The Python wrangle executes simple Python commands inline within a recipe. Row values are referenced by column name and commands are evaluated once per row. Spaces within column names are replaced by underscores (_). All columns are also available as a dictionary named kwargs. For more complex Python, use custom functions.
This wrangle evaluates the Python command. Be cautious when including variables from untrusted sources in the command string.
Parameters
Name Description Accepted Values Default Required I/O outputName or list of output column(s). To output multiple columns, return a list of the corresponding length. string, array — Yes inputName or list of input column(s) to filter the data available to the command. Useful in conjunction with kwargs to target a variable range of columns. If not specified, all columns will be available. string, integer, array, null nullNo Options commandPython command. This must return a value. Note: any non-alphanumeric characters in variable names are replaced by underscores (_). string — Yes Errors exceptValue to return for the row if an exception occurs during the evaluation. If not provided, an exception will be raised as normal. If multiple output columns are specified, this must match the length. string, array, number, integer, boolean, object — 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 : - python : output : result command : My_Column.upper()
The Python wrangle supports parameters so values of unknown origin can be injected safely.
wrangles : - python : output : sliced command : input_column [ : i ] i : $ { var }
Access Requirement Value AI-powered No Requires WrangleWorks account No Requires subscription No Requires external API key No
Technical details Field Value Catalog ID 85Catalog key pythonRecipe key pythonCatalog status active Lifecycle status active Recipe Writer eligible Yes Namespace Root-level Documentation group computeAliases None Runtime symbol wrangles.recipe_wrangles.main.pythonLegacy UUID c0398a11-7731-4e47-8df0-b07eea0b1d6c
Sources
SQL | sql
Apply a SQL command to the current dataframe. Only SELECT statements are supported - the result will be the output.
Apply a SQL command to the current dataframe. Only SELECT statements are supported; the result becomes the output. The current table is called df.
SQL does not currently work with objects. If your table contains objects, use convert.to_json before using SQL. SQL is not compatible with where filtering.
Parameters
Name Description Accepted Values Default Required Options commandSQL Command. The table is called df. For specific SQL syntax, this uses the SQLite dialect. string — Yes paramsVariables to use in conjunctions with query. This allows the query to be parameterized. This uses sqlite syntax (? or :name). array, object, null nullNo preserve_data_typesPreserve Data Types value accepted by the runtime. boolean trueNo Formatting preserve_indexPreserve Index value accepted by the runtime. boolean falseNo 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 : - sql : command : | SELECT header1, header2 FROM df WHERE header1 >= 2
Access Requirement Value AI-powered No Requires WrangleWorks account No Requires subscription No Requires external API key No
Technical details Field Value Catalog ID 94Catalog key sqlRecipe key sqlCatalog status active Lifecycle status active Recipe Writer eligible Yes Namespace Root-level Documentation group computeAliases None Runtime symbol wrangles.recipe_wrangles.main.sqlLegacy UUID 467a06b1-a697-4d31-8061-7d83a719fd79
Sources
Maths (Deprecated) | maths
This compatibility wrangle remains available for existing recipes. Use math for new recipes.
Deprecated alias for math; evaluate an expression and write its result to an output column.
Behavior
Deprecated alias for math; evaluate an expression and write its result to an output column.
This guidance was derived from the callable signature.
Parameters
Name Description Accepted Values Default Required I/O inputName, index, or list of input columns. string — Yes outputName or list of output columns. string — Yes 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
Access Requirement Value AI-powered No Requires WrangleWorks account No Requires subscription No Requires external API key No
Technical details Field Value Catalog ID 83Catalog key mathsRecipe key mathsCatalog status active Lifecycle status deprecated Recipe Writer eligible No Recipe Writer exclusion Deprecated compatibility key; use math. Replaced by mathNamespace Root-level Documentation group computeAliases None Runtime symbol wrangles.recipe_wrangles.main.mathsLegacy UUID None
Sources