I haven't use numpy to his full potential yet. I have this pretty huge 3d array (700000 x 32 x 32). All of the values are int between 1 and 4. I want to be able to filter the array so that the I get a same shape array, but only with 1 for values of 4 and 0 for everything else.
For example,
[[4, 2, 2, 3], [[1, 0, 0, 0],
[1, 4, 4, 2], [0, 1, 1, 0],
[2, 4, 1, 3], -> [0, 1, 0, 0],
[2, 3, 2, 4]] [0, 0, 0, 1]]
It works with np.where(array==4)
. I get a huge 3d array that I can reshape, but would there more numpy way to do it ? Thanks.