i am using stats.pearsonr to find the r values which can be used to calculate the similarities between two vectors (lists) of numbers, such as gene expression values. both dic[gene[i]] and dic[gene[j]] are lists
dic[gene[j]] = ['145.544', '135.24', '56.5138', '135.826', '100.222', '67.9036', '71.9729', '64.8282', '98.5264', '8.81885', '74.5485', '36.8456', '165.306', '137.346']
dic[gene[i]] =['157.156', '431.292', '401.941', '243.974', '196.058', '8.54743', '527.666', '603.364', '189.298', '165.956', '81.9865', '214.528', '511.015', '431.634']
however, i can't seem to run the code even though the list contains floats
network = []
for i in range(len(gene)):
for j in range(i):
r, p = stats.pearsonr(dic[gene[i]], dic[gene[j]])
if r>0.99:
network.append([gene[i],gene[j]])
print(len(network))
i got this as error
/usr/local/lib/python3.7/dist-packages/scipy/stats/stats.py in pearsonr(x, y)
3512 # that the data type is at least 64 bit floating point. It might have
3513 # more precision if the input is, for example, np.longdouble.
-> 3514 dtype = type(1.0 + x[0] + y[0])
3515
3516 if n == 2:
TypeError: unsupported operand type(s) for +: 'float' and 'numpy.str_'
any idea how?