numpy arrays

Heli hemla21 at gmail.com
Wed Mar 23 06:06:56 EDT 2016


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,  



More information about the Python-list mailing list