1
The program organizes is made to organize the lines, based on the value of the third column, I did the program and it worked, but when I use numpy matrix, gives the error below. i need to use numpy array because it is part of a larger program that I am using numpy.
import numpy as np
y = np.matrix([[-1,1,4],[2,-2,7],[10,7,1]])
c = True
def OrdenaMatriz(y):
    matriz = []
    matriz.append(y[0])
    for a in range(2):
        if y[a,2] < y[a+1,2]:
            matriz.insert(a,y[a+1])
        else:
            matriz.append(y[a+1])
    return matriz
while c == True:
    a = OrdenaMatriz(y)
    if a == y:
        c = False
        print(a)
    y = a
MISTAKE YOU ARE MAKING:
DeprecationWarning: elementwise == comparison failed; this will raise an 
error in the future.
  if a == y:
Traceback (most recent call last):
  File "teste.py", line 26, in <module>
    a = OrdenaMatriz(y)
  File "teste.py", line 19, in OrdenaMatriz
    if y[a,2] < y[a+1,2]:
TypeError: list indices must be integers or slices, not tuple
Hello @João-Vitor-Degrandi, okay. I can try to help, but what would a normal Matrix be? It would be a list of lists ?
– Davi Mello