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


Groups > comp.lang.python > #105531

numpy arrays

Newsgroups comp.lang.python
Date 2016-03-23 03:06 -0700
Message-ID <3774dc9b-f9d3-462b-bbe4-41b8b2244db7@googlegroups.com> (permalink)
Subject numpy arrays
From Heli <hemla21@gmail.com>

Show all headers | View raw


Hi, 

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]]

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. 

Thanks for your help,  

Back to comp.lang.python | Previous | NextNext 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