a = [1,2,3]
b = [2,3,4]
c = [1,2,4]
d = [1,3,6]
Hi, all,
I have the above lists, I'd like to show pairwise intersection/overlap (# of duplicated integers) of the each two lists like the following format. Any one knows how to achieve this? (any method would be great, but just curious is iterative/loop the only method to achieve this?)
a b c d
a 3 2 2 2
b 2 3 2 1
c 2 2 3 1
d 2 1 1 3
The true goal is more difficult for me, I need to sum up all duplicated number in each two list. For example, list a and list b are duplicated in number 2 and 3, thus I need 5 here. The ultimate goal is like below:
a b c d
a 6 5 3 4
b 5 9 6 3
c 3 6 7 1
d 4 3 1 10