Having an original numpy array like:
a = np.array([
[12, 43],
[42, 23],
[33, 22],
[53, 15],
[34, 31]
])
I want to add a new column to a based on an array of indices:
indices = np.array([2, 3])
such that a becomes:
# if index is in "indices", new value is 1, otherwise 0
a = np.array([
[12, 43, 0],
[42, 23, 0],
[33, 22, 1],
[53, 15, 1],
[34, 31, 0]
])
Note: I cannot use Pandas in this context, it has to be a pure numpy solution