Convert string list to binary list in pyspark
问题 I have a dataframe like this data = [(("ID1", ['October', 'September', 'August'])), (("ID2", ['August', 'June', 'May'])), (("ID3", ['October', 'June']))] df = spark.createDataFrame(data, ["ID", "MonthList"]) df.show(truncate=False) +---+----------------------------+ |ID |MonthList | +---+----------------------------+ |ID1|[October, September, August]| |ID2|[August, June, May] | |ID3|[October, June] | +---+----------------------------+ I want to compare every row with a default list, such that