Posts by User0604 • 1 point
1 post
-
0
votes2
answers22
viewsQ: how to create an udf using two columns and if expression
I’m doing a job using Pyspark and SQL have that function: selection = F.udf(lambda x: cumulative_sum._1 if 100*random.random()<= x, FloatType()) cumulative_sum.withColumn('Selection2',…