Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #77158

Re: Convert 3d NumPy array into 2d

Date 2014-08-27 12:34 -0700
From Gary Herron <gary.herron@islandtraining.com>
Subject Re: Convert 3d NumPy array into 2d
References <CAEqOoUqDVpvP3KqvdC3Vu5HK=uB-uHpdycT4o9zfAbtzsGUM+A@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.13522.1409168507.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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


Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Convert 3d NumPy array into 2d Gary Herron <gary.herron@islandtraining.com> - 2014-08-27 12:34 -0700

csiph-web