Reputation: 33
1,John,NY
2,Bill,FL
3,Harry,TX
I have a textfile with above data.
val rdd = sc.textFile("/path").map(x=>(x.split(",")(0).toInt,x.split(",")(1),x.split(",")(2)))
After this how can i filter data where name is Bill or number is > 2 ? Or is there another way to do it without split function?
Upvotes: 0
Views: 312
Reputation: 10372
Use filter
function.
df
.map(x=>(x.split(",")(0).toInt,x.split(",")(1),x.split(",")(2)))
.filter(row => row._2 == "Bill" || row._1 > 2)
Upvotes: 1