StringIndexer (Spark 3.5.5 JavaDoc) (original) (raw)


public class StringIndexer
extends Estimator<StringIndexerModel>
implements StringIndexerBase, DefaultParamsWritable
A label indexer that maps string column(s) of labels to ML column(s) of label indices. If the input columns are numeric, we cast them to string and index the string values. The indices are in [0, numLabels). By default, this is ordered by label frequencies so the most frequent label gets index 0. The ordering behavior is controlled by setting stringOrderType.
See Also:
IndexToString for the inverse transformation, Serialized Form