Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trouble with Sort
#6
It seems that you use Numpy arrays. I don't think built-in function will give you what you expect. I would create a list out of the array. Please have a look at the following code.
import numpy as np

A = np.array([[1,3],[6,4],[5, 0]])
print(A)

print('Sorted is: ')
print(np.sort(A))

# lista = []

# for i in range (len(A)):
#     lista.append(A[i])

# print (lista)
# B = sorted(lista, key = lambda e:e[1])
# print(B)
Reply


Messages In This Thread
Trouble with Sort - by Milfredo - Sep-13-2020, 10:14 AM
RE: Trouble with Sort - by Askic - Sep-13-2020, 10:51 AM
RE: Trouble with Sort - by Milfredo - Sep-13-2020, 06:50 PM
RE: Trouble with Sort - by scidam - Sep-14-2020, 12:44 AM
RE: Trouble with Sort - by Milfredo - Sep-14-2020, 04:12 AM
RE: Trouble with Sort - by Askic - Sep-14-2020, 05:50 AM
RE: Trouble with Sort - by Milfredo - Sep-14-2020, 06:56 AM
RE: Trouble with Sort - by Askic - Sep-14-2020, 02:21 PM
RE: Trouble with Sort - by Milfredo - Sep-14-2020, 02:37 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Photo a.sort() == b.sort() all the time 3lnyn0 1 1,345 Apr-19-2022, 06:50 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020