0

I have a list of tuple of numbers which brings the data from the dataframe. I extract the data from the dataframe which corresponds to the numbers(SNO). I want to pass that data into a function which accepts Row as a parameter. I am thinking to convert that dataframe into List of tuple of Rows => List(Tuple2(Row, Row)) So that I can pass those rows into a function in interative basis. Any efficient method would e appreciated. Imagine I have val list0: List[(Int, Int)] = List((1,2),(5,4),(3,6)) & I have two sample dataframe

+-------+-----+-------+
|Country| Item|groupNo|
+-------+-----+-------+
|  India|mango|      1|
|  India|Apple|      5|
|  India| musk|      3|
+-------+-----+-------+

and another dataframe is like

+-------+-----+-------+
|Country| Item|groupNo|
+-------+-----+-------+
|  India| musk|      2|
|  India|mango|      6|
|  India|mango|      4|
+-------+-----+-------+

So I want result like

List((Row(India,mango,1), Row(India,musk,2)), (Row(India,Apple,5), Row(India,mango,4)), etc...)

So that I can pass that List(Tuple2(Row, Row)) to a certain function as it is.

Rohan
  • 31
  • 5
  • Could you please share whatever code you have tried. – hagarwal Dec 03 '19 at 09:49
  • Maybe you could also add some example data (input and expected output)? This would make your question easier to understand – werner Dec 03 '19 at 18:52
  • Hi @werner, I have shared sample code to you. Hope it helps to understand. If anything comes in your mind ask me or any efficient idea you have. Share then – Rohan Dec 04 '19 at 07:08
  • does [this post](https://stackoverflow.com/a/32884253/2129801) answer your question? – werner Dec 07 '19 at 13:48

0 Answers0