I have a csv file with two columns like this:
column1 column2
sachin@@@tendulkar@@@Ganguly cricket@@@India@@@players
I want to convert it to a hash map which would be like this:
sachin-> "cricket, India, players"
tendulkar-> "cricket, India, players"
Ganguly-> "cricket, India, players"
cricket, India, players this should be a one string. How can I get it done in scala? This is what I have done so far
val csv = sc.textFile("/tag/players.csv")
val headerAndRows = csv.map(line => line.split(",").map(_.trim))
val header = headerAndRows.first()
val synonyms = csv.map(_.split(",")).map( p=>(p(1)) // for column1
val targettag = csv.map(_.split(",")).map(p=>p(2)) // for column2
val splitsyno = synonyms.map(x => x.split("@@@"))
val splittarget = targettag.map(x=>x.split("@@@"))
I want to know how to proceed forward to create the desired hashmap?
Map?