binarizer pyspark
#Binarizer dat nguong dat co 0 va 1 from pyspark.ml.feature import Binarizer df = df.withColumn("List_Day_of_Week",df["List_Day_of_Week"].cast("double")) binarizer = Binarizer(threshold=5.0,inputCol="List_Day_of_Week",outputCol="Listed_On_Weekend") df = binarizer.transform(df)