import numpy as np x = np.array(range(10 * 30)).reshape(100, 3) y = np.array(range(1010, 10, -10)) res = sorted(x, key = lambda y:y) #ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() res = sorted(x, key=y) #TypeError: 'tuple' object is not callable
Try argsort:
import numpy as np x = np.array(range(10 * 30)).reshape(100, 3) y = np.array(range(1010, 10, -10)) args = y.argsort(axis = 0) print x[args]
Source: https://habr.com/ru/post/1341454/More articles:What is included in the view and what happens in the view controller? - iphoneThe line was indented 2 levels deeper than the previous line. HAML - ruby-on-railshttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1341451/ways-to-create-a-qdialog-outside-the-main-thread&usg=ALkJrhiOx82wSQ1I8m4EOENTizO5L-7CJgCan I create a migration for the model? - ruby-on-railsRails3 seed data nested attributes - ruby-on-railsIs there an API in Windows 7 for creating βsplit menu itemsβ? - user-interfacezc.lockfile.LockError in ZODB - pythonRecord in CSV files and then Zipping it in Appengine (Java) - javaAuthentication without username / password? - authenticationCheck if the text of the text field has been changed since the opening of the form - c #All Articles