I have a 3d array like this:
array([[[ 0,  1],
        [ 0,  0]],
        [[ 0,  0],
        [ 6,  7]]])
What I am trying to do is reduce it to a 2d array like this:
array([[1, 0],
       [0, 1]])
Where there is a 1 for each sub-array of the original that had non-zero elements, and a 0 if all the elements of the corresponding sub-array were zero.
How can I do this cleanly, without loops?