Sort numpy.array Zeilen nach Indizes
Ich habe 2Dnumpy.array
und ein Tupel von Indizes:
a = array([[0, 0], [0, 1], [1, 0], [1, 1]])
ix = (2, 0, 3, 1)
Wie kann ich die Zeilen eines Arrays nach den Indizes sortieren? Erwartetes Ergebnis
array([[1, 0], [0, 0], [1, 1], [0, 1]])
Ich habe versucht mitnumpy.take
, aber es funktioniert erwartungsgemäß nur mit 1D-Arrays.