String Indexer

Maps a string column of labels to an integer column of label indices.

This operation is ported from Spark ML.

For a comprehensive introduction, see Spark documentation.

For scala docs details, see org.apache.spark.ml.feature.StringIndexer documentation.

Since: Seahorse 1.0.0

Input

Port Type Qualifier Description
0DataFrameThe input DataFrame.

Output

Port Type Qualifier Description
0DataFrameThe output DataFrame.
1TransformerA Transformer that allows to apply the operation on other DataFrames using a Transform.

Parameters

Name Type Description
operate on InputOutputColumnSelector The input and output columns for the operation.

Example

Parameters

Name Value
operate on one column
input column "city"
output append new column
output column "city_indexed"

Input

city price
CityA 695611.0
CityC 294691.0
CityB 430784.0
CityB 336677.0
CityA 584639.0
CityA 579560.0

Output

city price city_indexed
CityA 695611.0 0.0
CityC 294691.0 2.0
CityB 430784.0 1.0
CityB 336677.0 1.0
CityA 584639.0 0.0
CityA 579560.0 0.0