Compute wrangles, with recipe examples, parameters, and behavior.
Case When
Assign values to a column based on conditional logic.
Parameters
| Name | Description | Accepted Values | Default | Required |
|---|
| I/O | | | | |
output | Name of the output column. | string | — | Yes |
| Options | | | | |
cases | List of conditions and corresponding values. | array | — | Yes |
default | Value to assign if no conditions are met. Default None. | string, number, integer, boolean, null | null | 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:
- 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 | 3 |
| Catalog key | compute.case_when |
| Recipe key | compute.case_when |
| Catalog status | active |
| Lifecycle status | active |
| Recipe Writer eligible | Yes |
| Namespace | compute |
| Documentation group | compute |
| Aliases | None |
| Runtime symbol | wrangles.recipe_wrangles.compute.case_when |
| Legacy UUID | 9a9662e4-53d1-4932-8adf-bc3e7aa364ad |
Sources
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 | | | | |
input | List of 3 to 5 columns -> [results, suppliers, part_codes, mpns (optional), descriptions (optional)]. | array | — | Yes |
output | Output column for the dictionaries. If a list of 2 is provided, outputs [dicts_column, pretty_strings_column]. | string, array | — | Yes |
| Options | | | | |
must_match_part_code | If true, filters out results that don't satisfy the allowed match types. | boolean | true | No |
allow_mpn_exact | Treat exact MPN matches as valid part code matches. | boolean | true | No |
allow_mpn_partial | Treat partial MPN matches as valid part code matches. | boolean | true | No |
allow_other_exact | Treat exact other part code matches as valid part code matches. | boolean | true | No |
allow_other_partial | Treat partial other part code matches as valid part code matches. | boolean | true | No |
blacklist_keywords | Comma-separated list or array of keywords to filter out URLs containing them. | string | "" | No |
mpn_exact_score | Mpn Exact Score value accepted by the runtime. | number | 8 | No |
mpn_partial_base | Mpn Partial Base value accepted by the runtime. | number | 4 | No |
part_code_exact_score | Part Code Exact Score value accepted by the runtime. | number | 6 | No |
part_code_partial_base | Part Code Partial Base value accepted by the runtime. | number | 2 | No |
supplier_exact_score | Supplier Exact Score value accepted by the runtime. | number | 3 | No |
supplier_partial_base | Supplier Partial Base value accepted by the runtime. | number | 1 | No |
context_match_base | Context Match Base value accepted by the runtime. | number | 2 | No |
fuzzy_match_threshold | Fuzzy Match Threshold value accepted by the runtime. | number | 0.8 | 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
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 | 4 |
| Catalog key | compute.score_search_results |
| Recipe key | compute.score_search_results |
| Catalog status | active |
| Lifecycle status | active |
| Recipe Writer eligible | Yes |
| Namespace | compute |
| Documentation group | compute |
| Aliases | None |
| Runtime symbol | wrangles.recipe_wrangles.compute.score_search_results |
| Legacy UUID | 313a8ec0-cf13-4956-8d3b-5362b8641d0f |
Sources
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 | | | | |
input | The mathematical expression using column names. e.g. column1 * column2 + column3. Note: spaces within column names are replaced by underscores (_). | string | — | Yes |
output | The column to output the results to. | string | — | Yes |
| 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:
- 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 | 82 |
| Catalog key | math |
| Recipe key | math |
| Catalog status | active |
| Lifecycle status | active |
| Recipe Writer eligible | Yes |
| Namespace | Root-level |
| Documentation group | compute |
| Aliases | None |
| Runtime symbol | wrangles.recipe_wrangles.main.math |
| Legacy UUID | 494b11ad-00c1-4748-8b93-6bec982f4fec |
Sources
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 | | | | |
output | Name or list of output column(s). To output multiple columns, return a list of the corresponding length. | string, array | — | Yes |
input | Name 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 | null | No |
| Options | | | | |
command | Python command. This must return a value. Note: any non-alphanumeric characters in variable names are replaced by underscores (_). | string | — | Yes |
| 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 |
| Errors | | | | |
except | Value 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 |
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 | 85 |
| Catalog key | python |
| Recipe key | python |
| Catalog status | active |
| Lifecycle status | active |
| Recipe Writer eligible | Yes |
| Namespace | Root-level |
| Documentation group | compute |
| Aliases | None |
| Runtime symbol | wrangles.recipe_wrangles.main.python |
| Legacy UUID | c0398a11-7731-4e47-8df0-b07eea0b1d6c |
Sources
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 | | | | |
command | SQL Command. The table is called df. For specific SQL syntax, this uses the SQLite dialect. | string | — | Yes |
params | Variables to use in conjunctions with query. This allows the query to be parameterized. This uses sqlite syntax (? or :name). | array, object, null | null | No |
preserve_data_types | Preserve Data Types value accepted by the runtime. | boolean | true | No |
| Formatting | | | | |
preserve_index | Preserve Index value accepted by the runtime. | 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:
- 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 | 94 |
| Catalog key | sql |
| Recipe key | sql |
| Catalog status | active |
| Lifecycle status | active |
| Recipe Writer eligible | Yes |
| Namespace | Root-level |
| Documentation group | compute |
| Aliases | None |
| Runtime symbol | wrangles.recipe_wrangles.main.sql |
| Legacy UUID | 467a06b1-a697-4d31-8061-7d83a719fd79 |
Sources
Maths (Deprecated)
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 | | | | |
input | Name, index, or list of input columns. | string | — | Yes |
output | Name or list of output columns. | string | — | Yes |
| 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 |
Access
| Requirement | Value |
|---|
| AI-powered | No |
| Requires WrangleWorks account | No |
| Requires subscription | No |
| Requires external API key | No |
Technical details
| Field | Value |
|---|
| Catalog ID | 83 |
| Catalog key | maths |
| Recipe key | maths |
| Catalog status | active |
| Lifecycle status | deprecated |
| Recipe Writer eligible | No |
| Recipe Writer exclusion | Deprecated compatibility key; use math. |
| Replaced by | math |
| Namespace | Root-level |
| Documentation group | compute |
| Aliases | None |
| Runtime symbol | wrangles.recipe_wrangles.main.maths |
| Legacy UUID | None |
Sources