I have the following numpy array:
import numpy as np
pair_array = np.array([(205, 254), (205, 382), (254, 382), (18, 69), (205, 382), 
                       (31, 183), (31, 267), (31, 382), (183, 267), (183, 382)])
print(pair_array)
#[[205 254]
# [205 382]
# [254 382]
# [ 18  69]
# [205 382]
# [ 31 183]
# [ 31 267]
# [ 31 382]
# [183 267]
# [183 382]]
Is there a way to transform this array to a symmetric pandas Dataframe that contains the count of occurences for all possible combinations? I expect something along the lines of this:
#     18  31  69 183 205 254 267 382 
#  18  0   0   1   0   0   0   0   0
#  31  0   0   0   1   0   0   1   1
#  69  1   0   0   0   0   0   0   0
# 183  0   1   0   0   0   0   1   1
# 205  0   0   0   0   0   1   0   2
# 254  0   0   0   0   1   0   0   1
# 267  0   1   0   1   0   0   0   0
# 382  0   1   0   1   2   1   0   0
 
     
     
     
     
    