Numeric to Categorical

Overview

This Snap converts categorical fields into numeric fields using Integer Encoding or One Hot Encoding.


Categorical to Numeric Overview

Prerequisites

None.

Limitations and known issues

None.

Snap views

View Description Examples of upstream and downstream Snaps
Input This Snap supports two document input views: the Data input view and the Profile input view.
Output This Snap supports one document output view. It generates numeric fields from the categorical input.
Error

Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter when running the pipeline by choosing one of the following options from the When errors occur list under the Views tab. The available options are:

  • Stop Pipeline Execution Stops the current pipeline execution when an error occurs.
  • Discard Error Data and Continue Ignores the error, discards that record, and continues with the remaining records.
  • Route Error Data to Error View Routes the error data to an error view without stopping the Snap execution.

Learn more about Error handling in Pipelines.

Snap settings

Legend:
  • Expression icon (): JavaScript syntax to access SnapLogic Expressions to set field values dynamically (if enabled). If disabled, you can provide a static value. Learn more.
  • SnapGPT (): Generates SnapLogic Expressions based on natural language using SnapGPT. Learn more.
  • Suggestion icon (): Populates a list of values dynamically based on your Account configuration.
  • Upload : Uploads files. Learn more.
Learn more about the icons in the Snap settings dialog.
Field / field set Type Description
Label String

Required. Specify a unique name for the Snap. Modify this to be more appropriate, especially if more than one of the same Snaps is in the pipeline.

Default value: Categorical to Numeric

Example: Catgry2Num

Policy

The preferences for fields and encoding methods. For each policy, select the input field with categorical values, the encoding method, and the result field.

Field String/Suggestion

Required. The field that must be transformed. This is a suggestible property that lists all available fields in the input documents.

Default value: None

Example: $value

Rule Dropdown list

Required. The type of transformation to be performed on the selected field. Two options are available:

  • Split by Values: Splitting the data into ranges specified by the Splits/Bins field. Each range is replaced with the text specified in the Prefix/Values field.
  • Binning: Splitting the data into equally-sized ranges based on the number of items specified in the Prefix/Values field. If you specify a prefix value in the Prefix/Values field, you must specify the number of bins in the Splits/Bins field.

Default value: Split by Values

Example: Binning

Prefix/Values String/Expression Categorical values to be used to replace original numeric values. You can specify either a prefix or multiple values in this field. For example, if the prefix is "group", the values will be "group_1", "group_2" and so on. In case of specifying values, use comma "," to separate them.

Default value: None

Example: v1,v2,v3,v4,v5,v6

Splits/Bins String/Expression The values to be entered into this property depends on the selection you made in the Rule field.
  • Split by Values: This field must contain a list of split points. "2,4,6,8,10" is the same as "2,4,...,10".
  • Binning: This field specifies the number of bins into which you want to divide the input data range.

Default value: None

Example: 2,4,6,8,10

Result field String/Suggestion

Required. The result field that must be used in the output map. If the Result field is the same as Field, the values are overwritten. If the Result field does not exist in the original input document, a new field is added.

Default value: None

Example: $value_1

Snap execution Dropdown list
Select one of the three modes in which the Snap executes. Available options are:
  • Validate & Execute: Performs limited execution of the Snap and generates a data preview during pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during pipeline runtime.
  • Execute only: Performs full execution of the Snap during pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Default value: Execute only

Example: Validate & execute