I want to convert below dataframe into Map[String,List[String]]. I have changed initial dataframe to get Name columns in List format(using collect_list) but I am not able to convert it into Map[String,List[String]].
DataFrame
+---------+-------+
|City | Name |
+---------+-------+
|Mumbai |[A,B] |
|Pune |[C,D] |
|Delhi |[A,D] |
+---------+-------+
Expected Output:
Map(Mumbai -> List(A,B), Pune -> List(C,D), Delhi-> List(A,D))