Doing the following transformation in pyspark.how can I adapt in to scala?
accept_value= when(col("column1") < 0.9, 1).otherwise(0)
Doing the following transformation in pyspark.how can I adapt in to scala?
accept_value= when(col("column1") < 0.9, 1).otherwise(0)
you can write something like this in scala.
import org.apache.spark.sql.functions.{col,when}
val accept_value = df.withColumn("converted_value", when(col("number").lt(0.9), 1).otherwise(0))
pyspark for reference:
from pyspark.sql.functions import col, when
accept_value = df.withColumn("converted_value",when(col("number") < 0.9, 1).otherwise(0))