I try to sort values in an array in descending order. If I try it in ascending order it works, but when i do it descending I get an error.
e = np.array([[5.,3.,8.],[6.,7.,1.],[4.,8.,2.]])
e.sort()
result:
e = array([[3.,5.,8.],[1.,6.,7.],[2.,4.,8.]])
now in reverse order:
e.sort(reverse=True)
result:
TypeError: 'reverse' is an invalid keyword argument for this function
I also tried e.sort(key=itemgetter(1)) after from operator import itemgetter but the same error appears ('reverse' is replaced by 'key').
Why is this the case? Why does it not work? Why this error (this is the way to use key or reverse right)?
f = -np.sort(-e)worked perfect!