Problem with numpy array

1

I'm having a problem using NUMPY. It has a testeSolucao array, of that type <class 'numpy.matrixlib.defmatrix.matrix'> , and I need to get the lowest value of it, but I can not. First I thought it was a vector, but it's generating this array because of the operations I'm doing. And as it is a matrix with only one line I'm trying to get line 0 of it and go get indexes, but every return of menor I always get [[ 7.5 3. 0.25]] .

def verificaSolucao(testeSolucao):
    indice = 0
    menor = testeSolucao[0][indice]

    for i in range(1, 3, 1):
        if testeSolucao[0][indice] < menor:
            menor = testeSolucao[0][indice]
            indice = i

    if menor<0.0:     
        return (indice)
    else:
        return (-1)
    
asked by anonymous 30.09.2017 / 18:44

1 answer

0

I found a solution testeSolucao.item(i) works by picking up each item

    
11.10.2017 / 12:18