On Wed, Mar 23, 2016 at 9:06 PM, Heli <heml...@gmail.com> 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]]

What you want is called *transposing* the array:

http://docs.scipy.org/doc/numpy/reference/generated/numpy.transpose.html

That should be a sufficiently fast operation.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to