just need to know how can we update values inside a df with specific condition.
If my approach is wrong please suggest one
while (i<myList.length-1)
{
j=1
while(j<myList.length)
{
result = sqrt(pow(myList(i)- myList(j),2) + pow(myList2(i) - myList2(j),2))
if(result>=3.4)
df3.withColumn("New_Id", col("id")+1) // if the coundition satisfies I need to update the new value as 1,2,3, .... in the New_id column
j=j+1;
}
i=i+1
}
df3.show(10)
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…