StringIndexer pyspark

df_i = spark.createDataFrame([
    ("a", 2.0),
    ("c", 1.0),
    ("b", 2.0),    
    ("a", 1.0),
    ("a", 0.0),   
    ("c", 1.0)
], ["categoryIndex", "categoryIndex2"])
stringID = StringIndexer(inputCol="categoryIndex",outputCol="categoryIndex2")
indexer = stringID.fit(df_i)
df_i = indexer.transform(df_i)
df_i.show()
Sore Stork