Log in or register to post comments StringIndexer is used when a label does not have an integer value. Models generally prefer prediction columns to be of integer type rather than string type. It is similar to the LabelEncoder of sklearn. Tags Spark MLlib Interview Questions