1
The problem is in matrix.append([(x+1), vectorY[x][1]])
.
No matter how much vextor[x][1]
is different from (x+1)
, when added you will receive the same value as (x+1)
, leaving a matrix with two equal values, ex: ([1 , 1])
This is the full code link: https://gist.github.com/anonymous/e6e89ee4b4dcc6e6b247#file-spearman_eng-py
def createMatrixDi(self, matrixxy):
matrixxy.sort()
vectorY = []
index = 1
for values in matrixxy:
vectorY.append( [ values[1], index ])
index += 1
x = 0
matrix= []
while (x < len(vectorY)):
matrix.append( [(x+1), vectorY[x][1]] )
x += 1
return(matrix, len(vectorY))
Which error?
– Leonel Sanches da Silva
The error is that the matrix is being generated wrong. Instead of creating a matrix of the type: ([1,2], [2,4],[3,3]) , a matrix of always equal values is being created: ([1,1], [2,2], [3,3])
– exg
And what input is used? The value of
matrixxy
?– Leonel Sanches da Silva
No matter the input, it will always generate this error. This error is inexplicable, I’m already thinking it is Python bug. I’ll use numpy and if it works I put the solution here.
– exg