I have a CSV of 10k rows and I want to find out some pattern. I am referring example for Apache Spark docs. In below example in place of items I am giving list of columns, but getting error.
The input column must be ArrayType
, but StringType
.
FPGrowthModel model = new FPGrowth()
.setItemsCol("items")
.setMinSupport(0.5)
.setMinConfidence(0.6)
.fit(itemsDF);
How to create ArrayType
?
Try this-
val new_itemsDF = itemsDF.withColumn("items", array(col("items")))
FPGrowthModel model = new FPGrowth()
.setItemsCol("items")
.setMinSupport(0.5)
.setMinConfidence(0.6)
.fit(new_itemsDF);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.