📅  最后修改于: 2022-03-11 14:46:23.880000             🧑  作者: Mango
from pyspark.ml.feature import OneHotEncoder,StringIndexer
encodeer = OneHotEncoder(inputCol="City_Index",outputCol="City_Vec")
encodeer_df = encodeer.fit(indexed).transform(indexed)
encodeer_df["City_Index","City_Vec"].show(5)