[英]Check if value from one dataframe column exists in another dataframe column using Spark Scala
[英]Spark Scala copy column from one dataframe to another
我有一个在其上进行聚类的原始数据帧的修改版本,现在我想将预测的列带回原始DF(索引正常,因此匹配)。 我应该怎么做? 有了这段代码,我得到一个错误。
println("Predicted:")
dfWithOutput.show
println("Original:")
originalDF = originalDF.withColumn("cluster", dfWithOutput.col("prediction")
Exception in thread "main" org.apache.spark.sql.AnalysisException: Resolved attribute(s) prediction#2121 missing from (list of columns in the original df)
您需要加入两个数据框,然后选择您感兴趣的列
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.