Reputation: 57
After comparison between an array total= np.full((3,3),[0, 1, 2])
and array a = np.array([1],[0],[1])
, I am looking to get a new_array
:
array([[0, 2],
[1, 2],
[0, 2]])
Upvotes: 0
Views: 149
Reputation: 1858
Can apply a mask and reshape:
import numpy as np
total= np.full((3,3),[0, 1, 2])
a = np.array([[1],[0],[1]])
a = np.repeat(a, 3, axis=1)
new_total = total[total!=a].reshape(3, 2)
>>> print(new_total)
[[0 2]
[1 2]
[0 2]]
Upvotes: 0