Is there a method in numpy that allows me to sort these 3d vectors in ascending order?
For example; I have the following input array and I'd like the following output:
input_arr = np.array( [
[[255,0,3],
[255,4,100],
[255,2,3],
[255,3,3],
[0,1,3],
] ]
, dtype='uint8')
# Sort input_arr to produce the below
output_arr = np.array( [
[[0,1,3],
[255,0,3],
[255,2,3],
[255,3,3],
[255,4,100],
] ]
, dtype='uint8')
I have tried the below but it does not produce the result I wanted above. Instead it produces the below.
output_arr2 = np.sort( input_arr, axis=0)
# Results in the below
[[[255 0 3]
[255 4 100]
[255 2 3]
[255 3 3]
[ 0 1 3]]]