Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:: [': 0.04; "'a'": 0.09; 'subject:into': 0.09; 'url:github': 0.09; 'cc:addr:python- list': 0.11; 'array.': 0.16; 'numpy': 0.16; 'stuart': 0.16; 'subject:Convert': 0.16; 'subject:array': 0.16; 'obviously': 0.18; 'everyone,': 0.19; 'subject:] ': 0.20; 'cc:addr:python.org': 0.22; 'cc:2**1': 0.23; 'cheers,': 0.24; '(see': 0.26; 'header:In-Reply- To:1': 0.27; '[1]': 0.29; 'array': 0.29; 'message- id:@mail.gmail.com': 0.30; "skip:' 10": 0.31; 'dimensions': 0.31; 'cc:no real name:2**1': 0.33; 'convert': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'useful': 0.36; 'url:org': 0.36; 'how': 0.40; 'url:reference': 0.84; 'url:v1': 0.84; 'sfxlen:1': 0.91; 'url:core': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=EJOfmFtMoKhjtKqtu5OIME3k9jhWMuenpygXkRK7o7M=; b=dR82PLbOaNo0wbboRkNC6f4EtTYQpresqDrYmaBcAfaswbzA6T9DwblxfIsU1G+9o2 ItnlJ6AHpbi1RCKBv8UgSH3s36mcN9dlY2PL24jfzGku6KuAFtC/FTxpDT6JRejTxTTg 0kr5k1SG4FRn3LZ3QWUzKIKbuDHJQlL9/wEjA8jbW+H1hA9kTOj5OeeUbdubEi4GsoXP XB76HMQp0iU7pKB0Z1+S/ztsNO/KCaRIqWq8XUtDNZN0ML64UkB6sC9CBkjKwTNMiaWm AQ2AsSbnSaeeKzI9Dx5J2buoyt8kdHmsIhPLp/Ty3WS5yY93ZKRZ9t6hld0Y06YP697B q/MQ== MIME-Version: 1.0 X-Received: by 10.182.137.195 with SMTP id qk3mr30300928obb.5.1409156297721; Wed, 27 Aug 2014 09:18:17 -0700 (PDT) In-Reply-To: References: Date: Wed, 27 Aug 2014 17:18:17 +0100 Subject: Re: [SciPy-User] Convert 3d NumPy array into 2d From: Maximilian Albert To: SciPy Users List Content-Type: multipart/alternative; boundary=001a11c361f68f121005019ec43f Cc: python-list@python.org, numpy-discussion@scipy.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 55 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1409156305 news.xs4all.nl 2932 [2001:888:2000:d::a6]:36644 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77144 --001a11c361f68f121005019ec43f Content-Type: text/plain; charset=UTF-8 [source] 2014-08-27 16:08 GMT+01:00 phinn stuart : > Hi everyone, how can I convert (1L, 480L, 1440L) shaped numpy array into > (480L, 1440L)? > If 'a' is your array then 'a.squeeze()' or 'a.squeeze(axis=0)' will do the job (see the docs at [1]). You can also say a.reshape(480, 1440) but obviously this is only useful if you know the exact dimensions of your array. Cheers, Max [1] http://docs.scipy.org/doc/numpy/reference/generated/numpy.squeeze.html --001a11c361f68f121005019ec43f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
[source]=
2014-08-27 16:08 GMT+01:00 phinn stuart <d= phinnstuart@gmail.com>:
Hi everyone, how can I convert=C2=A0(1L, 480L, 1440L) shap= ed numpy array into (480L, 1440L)?

If 'a' is your array then 'a.squeeze()' or 'a.squee= ze(axis=3D0)' will do the job (see the docs at [1]). You can also say a= .reshape(480, 1440) but obviously this is only useful if you know the exact= dimensions of your array.

Cheers,
Max


--001a11c361f68f121005019ec43f--