Convert 3d NumPy array into 2d

Gary Herron gary.herron at islandtraining.com
Wed Aug 27 15:34:07 EDT 2014


On 08/27/2014 08:08 AM, phinn stuart wrote:
> Hi everyone, how can I convert (1L, 480L, 1440L) shaped numpy array 
> into (480L, 1440L)?
>
> Thanks in the advance.
>
> phinn
>
>

A simple assignment into the arrays shape does it:
 >>> a = numpy.zeros((1,480,1440))
 >>> a.shape
(1, 480, 1440)
 >>> a.shape = (480,1440)
 >>> a.shape
(480, 1440)

Gary Herron


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140827/aa6410e1/attachment.html>


More information about the Python-list mailing list