age.foreach(println)
1,5
2,25
3,30
Age has id and age. Now I have to create like If(age>=1 && age<10) "1-10" Else if(age >=10 && age<20) "10-20" Else "30+"
So the result for the above data should be
1, 1-10
2, 10-20
3, 30+
Val ager = age.map(x => (x(0),(If(x(1)>=1 && x(1)<10) "1- 10"
Else if(x(1) >=10 && x(1)<20) "10-20"
Else "30+")))
I am getting the below error: Error: org.apache.spark.rdd.RDD[(String,Int)] does not take parameter
Kindly help me to resolve this problem.