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


Groups > comp.lang.python > #105535

Re: numpy arrays

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Manolo Martínez <manolo@austrohungaro.com>
Newsgroups comp.lang.python
Subject Re: numpy arrays
Date Wed, 23 Mar 2016 11:26:48 +0100
Lines 27
Message-ID <mailman.44.1458729502.2244.python-list@python.org> (permalink)
References <3774dc9b-f9d3-462b-bbe4-41b8b2244db7@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace news.uni-berlin.de LrdpEYSRO8SYPlS0baRKNQWZJMIK2+9IYuWbwV1UyuHA==
Return-Path <manolo@austrohungaro.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.022
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'cc:addr:python-list': 0.09; 'arrays.': 0.16; 'numpy': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'element': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'arrays': 0.22; 'cc:no real name:2**0': 0.22; 'this:': 0.23; 'header:In-Reply- To:1': 0.24; 'header:User-Agent:1': 0.26; 'fastest': 0.27; 'this.': 0.28; 'array': 0.29; 'convert': 0.29; 'probably': 0.31; 'right?': 0.33; 'but': 0.36; 'there': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'charset:us-ascii': 0.37; 'mean': 0.38; "didn't": 0.39; 'your': 0.60; 'received:82.223': 0.84
Content-Disposition inline
In-Reply-To <3774dc9b-f9d3-462b-bbe4-41b8b2244db7@googlegroups.com>
User-Agent Mutt/1.5.24 (2015-08-30)
X-Mailman-Approved-At Wed, 23 Mar 2016 06:38:21 -0400
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
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>
Xref csiph.com comp.lang.python:105535

Show key headers only | View raw


On 03/23/16 at 03:06am, Heli wrote:

> I have a 2D numpy array like this:
> 
> [[1,2,3,4],
>  [1,2,3,4], 
>  [1,2,3,4]
>  [1,2,3,4]]
> 
> Is there any fast way to convert this array to 
> 
> [[1,1,1,1],
>  [2,2,2,2]
>  [3,3,3,3]
>  [4,4,4,4]]

You don't mean just transposing your original array, as in
original_array.T, right?

> In general I would need to retrieve every nth element of the interior
> arrays in to single arrays. I know I can loop over and do this, but I
> have really big arrays and I need the fastest way to do this. 

I didn't really get this, so transposing is probably not what you need.
Anyway, just in case!

Manolo

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


Thread

numpy arrays Heli <hemla21@gmail.com> - 2016-03-23 03:06 -0700
  Re: numpy arrays Steven D'Aprano <steve@pearwood.info> - 2016-03-23 21:32 +1100
  Re: numpy arrays Chris Angelico <rosuav@gmail.com> - 2016-03-23 21:35 +1100
    Re: numpy arrays Nobody <nobody@nowhere.invalid> - 2016-03-23 13:45 +0000
      Re: numpy arrays Heli <hemla21@gmail.com> - 2016-04-06 09:26 -0700
        Re: numpy arrays Heli <hemla21@gmail.com> - 2016-04-07 07:31 -0700
          Re: numpy arrays Heli <hemla21@gmail.com> - 2016-04-11 02:17 -0700
          Re: numpy arrays Heli <hemla21@gmail.com> - 2016-04-11 02:32 -0700
  Re: numpy arrays Manolo Martínez <manolo@austrohungaro.com> - 2016-03-23 11:26 +0100
  Re: numpy arrays Heli <hemla21@gmail.com> - 2016-03-23 03:47 -0700
  Re: numpy arrays Simon Ward <simon+python@bleah.co.uk> - 2016-03-23 10:47 +0000

csiph-web