# Encode Feature

## 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\]](/files/-ML5jHLLhYOmzG5Hngr6)

## 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\]](/files/-ML5kHLsqs7KVPwkf0lf)

## 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\]](/files/-ML_feBVuToIGe2bAEW0)

## 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)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hwasumok.gitbook.io/r-flow/python/data-preprocess/encode-feature.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
