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


Groups > comp.lang.python > #77158

Re: Convert 3d NumPy array into 2d

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <gary.herron@islandtraining.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'assignment': 0.07; 'arrays': 0.09; 'received:67.192': 0.09; 'received:67.192.241': 0.09; 'received:dfw.emailsrvr.com': 0.09; 'subject:into': 0.09; '(1,': 0.16; '480,': 0.16; 'numpy': 0.16; 'received:67.192.241.150': 0.16; 'received:smtp150.dfw.emailsrvr.com': 0.16; 'stuart': 0.16; 'subject:Convert': 0.16; 'subject:array': 0.16; 'wrote:': 0.18; 'advance.': 0.19; 'everyone,': 0.19; 'shape': 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; '&gt;&gt;&gt;': 0.24; 'received:emailsrvr.com': 0.24; 'received:(smtp server)': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'array': 0.29; 'gary': 0.31; 'convert': 0.35; 'thanks': 0.36; 'received:10': 0.37; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'simple': 0.61; 'charset:windows-1252': 0.65; 'received:10.10': 0.74
X-Virus-Scanned OK
X-Sender-Id gary.herron@islandtraining.com
Date Wed, 27 Aug 2014 12:34:07 -0700
From Gary Herron <gary.herron@islandtraining.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Convert 3d NumPy array into 2d
References <CAEqOoUqDVpvP3KqvdC3Vu5HK=uB-uHpdycT4o9zfAbtzsGUM+A@mail.gmail.com>
In-Reply-To <CAEqOoUqDVpvP3KqvdC3Vu5HK=uB-uHpdycT4o9zfAbtzsGUM+A@mail.gmail.com>
Content-Type multipart/alternative; boundary="------------030903060006040900020606"
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.13522.1409168507.18130.python-list@python.org> (permalink)
Lines 76
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1409168507 news.xs4all.nl 2898 [2001:888:2000:d::a6]:53506
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:77158

Show key headers only | 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