Monday, December 11, 2017

Scala - conditionally replace a column value - reference

https://stackoverflow.com/questions/32357774/scala-how-can-i-replace-value-in-dataframes-using-scala



1
2
3
import org.apache.spark.sql.functions._ 

val newsdf = df.withColumn("timestamp", when(col("make") === "Tesla","S").otherwise(col("make"))) 

No comments:

Post a Comment