Kindly have a look at input and expected output and suggest me efficient way of dealing it in Pyspark.
Input : A dataframe with
C1 x y
11 a 1
12 a 2
13 b 5
14 b 6
16 c &b
17 c 7
18 c b
Wher C1 , x and y are columns
Expected output :
C1 x y z
11 a 1 [1]
12 a 2 [2]
13 b 5 [5]
14 b 6 [6]
16 c &b [5,6]
17 c 7 [7]
18 c b [5,6]
'z' is the expected column where it should fetch corresponding 'b' values for 'c'
It should fetch [5,6] for both &b and b in 5th row for 'c' .
Thanks in advance