I want to write a code that appends a value to the order multidimensional array. If the last column is 0 order indx[-1:,1] (function for the last element in the first column) the it will append 10000 to the second column as well as 1 on the first column (1, 10000). If the first column last element is 1 than it will append 2 in the first column and 20000 in the second column (2, 20000). How could i write such code without the use of a for loop or list comprehensions.
import numpy as np
order = np.array([[ 0, 38846],
[ 1, 51599],
[ 0, 51599],
[ 1, 52598],
[ 0, 290480],
[ 1, 335368],
[ 0, 335916]])
Expected Output
#if the last element on column 1 is 1
[[ 0, 38846]
[ 1, 51599]
[ 0, 51599]
[ 1, 52598]
[ 0, 290480]
[ 1, 335368]
[ 0, 335916]
[ 2, 20000]]
#if the last element on column 1 is 0
[[ 0 38846]
[ 1 51599]
[ 0 51599]
[ 1 52598]
[ 0 290480]
[ 1 335368]
[ 0 335916]
[ 1 10000]]
np.vstackto add the desired row.