[Numpy-discussion] (no subject)

Andre Martel soucoupevolante at yahoo.com
Fri Apr 20 14:15:45 EDT 2012


What would be the best way to remove the maximum from a cube and "collapse" the remaining elements along the z-axis ?
For example, I want to reduce Cube to NewCube:


>>> Cube
array([[[  13,   2,   3,  42],
        [  5, 100,   7,   8],
        [  9,   1,  11,  12]],

       [[ 25,   4,  15,   1],
        [ 17,  30,   9,  20],
        [ 21,   2,  23,  24]],

       [[ 1,   2,  27,  28],
        [ 29,  18,  31,  32],
        [ -1,   3,  35,   4]]])


NewCube

array([[[  13,   2,   3,  1],
        [  5, 30,   7,   8],
        [  9,   1,  11,  12]],

       [[ 1,   2,  15,  28],
        [ 17,  18,  9,  20],
        [ -1,   2,  23,   4]]])

I tried with argmax() and then roll() and delete() but these
all work on 1-D arrays only. Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120420/2ff1d5ae/attachment.html>


More information about the NumPy-Discussion mailing list