> For the complete documentation index, see [llms.txt](https://hwasumok.gitbook.io/r-flow/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hwasumok.gitbook.io/r-flow/python/data-preprocess/encode-feature.md).

# Encode Feature

OneHotEncoder, LabelEncoder, Data Categorize, Binarizer, KBinsDiscretizer

## OneHotEncoder

### Input Data

|                   | Inputs                                                                                                                                                          |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **\*Target Data** | Data input                                                                                                                                                      |
| **\*Output Name** | Name of the encoded data (fill it out at your discretion)                                                                                                       |
| **\*Encoder**     | <p>Name of the user-defined encoder module (fill it out at your discretion)</p><ul><li>name of the Encoder should be different from the output name. </li></ul> |
| **\*x**           | <p>Columns (variables) to be encoded</p><ul><li><strong>At least</strong> one column should be selected. </li></ul>                                             |

![\[Task Information of OneHotEncoder\]](https://3929524962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGaxNdSdRN_L_WNiX4I%2F-ML5hoK-QUctSdBQ_yWa%2F-ML5jHLLhYOmzG5Hngr6%2Fimage.png?alt=media\&token=79bc84ba-a846-48d4-95ef-1c6052e8f395)

## LabelEncoder, Binarizer, KBinsDiscretizer

### Input Data

|                   | Inputs                                                                                                                                                          |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **\*Target Data** | Data input                                                                                                                                                      |
| **\*Output Name** | Name of the encoded data (fill it out at your discretion)                                                                                                       |
| **\*Encoder**     | <p>Name of the user-defined encoder module (fill it out at your discretion)</p><ul><li>name of the Encoder should be different from the output name. </li></ul> |
| **\*x**           | <p>Columns (variables) to be encoded</p><ul><li><strong>Only</strong> one column should be selected.</li></ul>                                                  |

![\[Task Information of Binarizer\]](https://3929524962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGaxNdSdRN_L_WNiX4I%2F-ML5hoK-QUctSdBQ_yWa%2F-ML5kHLsqs7KVPwkf0lf%2Fimage.png?alt=media\&token=1042428a-bcbc-45d5-b879-bc543e50abc1)

## Data Categorize

### Input Data

|                   | Inputs                                                                                                                                                                                                                                                                      |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **\*Target Data** | Data input                                                                                                                                                                                                                                                                  |
| \***Variable**    | Column of 'Target Data' to be categorized                                                                                                                                                                                                                                   |
| **\*Output Name** | Name of the categorized data (fill it out at your discretion)                                                                                                                                                                                                               |
| **New Variable**  | <p>Name of the categorized 'Variable' (fill it out at your discretion)<br>It will be stored as a new variable in 'Output Name' data. </p><ul><li>If empty, the categorized 'Variable' will be saved as a new variable in 'Output Name' data with no column name. </li></ul> |

### Arguments

|                      | Inputs                                                                  |
| -------------------- | ----------------------------------------------------------------------- |
| **\*Oper.**          | select equality/inequality signs                                        |
| \***Value 1**        | categorization criteria number                                          |
| **&**                | If there are 2 categorization criteria to categorize the data, use '&'. |
| **Oper.**            | select equality/inequality signs for criteria 2                         |
| **Value2**           | categorization criteria 2 number                                        |
| **Categorize Value** | Categorize Value of the data categorized by the set criteria.           |

![\[Task Information of Data Categorize\]](https://3929524962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGaxNdSdRN_L_WNiX4I%2F-ML_KUny6BC2BcnXio9S%2F-ML_feBVuToIGe2bAEW0%2Fimage.png?alt=media\&token=4954390c-31d5-4adb-98ca-c6b81b25a4d3)

## Workflow Example

[R-Flow Task Example Video: Data Categorize](https://www.youtube.com/watch?v=X6tJc_RftBE)

## Python Package

**OneHotEncoder:** [**https://scikit-learn.org/0.16/modules/generated/sklearn.preprocessing.OneHotEncoder.html**](https://scikit-learn.org/0.16/modules/generated/sklearn.preprocessing.OneHotEncoder.html)

**LabelEncoder:** [**https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.LabelEncoder.html**](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.LabelEncoder.html)

**Binarizer:** [**https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.Binarizer.html**](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.Binarizer.html)

**KBinsDiscretizer:** [**https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.KBinsDiscretizer.html**](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.KBinsDiscretizer.html)
