I have a PySpark dataframe that has 10000s of rows. The columns are (1) number of items occurring together as string and (2) the frequency of occurrence. I want to get how many times each items occurs with the rest of the items. I have sample data below.
pd.DataFrame({'items':['[a,b,c]','[c,d,e]', '[a,e]','[a,b,e]','[b,c]', '[c,d,e,b]'],'freq':[10, 16,7,2,6,5]})
The expected output is something like below.
[(a, b), 12], [(a, c), 10], [(c, d), 21], etc