I have PySpark dataframe (source_df) in which there is a column with values that are comma-separated.
I am trying to replace those values with a lookup based on another dataframe (lookup_df)
source_df
A B T ... followed by N unrelated columns...
foo a,b,c sam
bar k,a,c bob
faz b,a,f sam
lookup_df
C D
a h1
b h2
c h3
output dataframe:
A T B new_col ... followed by N unrelated columns...
foo sam a,b,c h1,h2,h3
bar bob h,a,c EMPTY,h1,h3
faz sam b,a,f h2,h1,EMPTY
Column A is a primary key and is always unique. Column T is unique for a given value of A.