Here is my data frame:
df = pd.DataFrame({'c1': [1, 4, 7, 5, 6], 'c2': [2, 5, 1, 7, 8], 'c3': [3, 1, 2, 4, 6], 'c4': [3, 9, 5, 4, 8], 'c5': [1, 2, 3, 4, 5], 'c6': [2, 5, 1, 7, 8]})
Digits represent a code of product (they are not numbers). I'm looking for something like correlation matrix, to compare similarity of columns (count intersections). Could you please help writing a loop counting number of similar codes for all columns?
Sample output:
C1 with c2 ... times, c3... times, c4... times, c5... times, c6... times
C2 with c3... times, c4... times, c5... times, c6... times
C3 with c4... times, c5... times, c6... times
And so on
P.S. I checked for duplicates, but was not able to find same problem.