Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

how to use the transpose function in numpy?

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


marlin_rowley at hotmail

May 17, 2008, 1:34 PM

Post #1 of 2 (179 views)
Permalink
how to use the transpose function in numpy?

All:

Say I have a series of arrays arranged like so:

[[[0,1,2,3]
[4,5,6,7]
[8,9,10,11]
[12,13,14,15]]

[[16,17,18,19]
[20,21,22,23]
[24,25,26,27]
[28,29,30,31]]]

Now if I do this: transpose((2,0,1)), I get this:

[[[0,4,8,12] [16,20,24,28]]
[[1,5,9,13] [17,21,25,29]]
[[2,6,10,14][18,22,26,30]]
[[3,7,11,15][19,23,27,31]]]

This is NOT what I want. I want the new array to be:

[0,4,8,12][1,5,9,13]
[2,6,10,14][3,7,11,15]
[16,20,24,28][17,21,25,29]
[18,22,26,30][19,23,27,31]

How do I do this?

-M
_________________________________________________________________
Make every e-mail and IM count. Join the i’m Initiative from Microsoft.
http://im.live.com/Messenger/IM/Join/Default.aspx?source=EML_WL_ MakeCount


robert.kern at gmail

May 17, 2008, 3:33 PM

Post #2 of 2 (160 views)
Permalink
Re: how to use the transpose function in numpy? [In reply to]

Ask numpy questions on the numpy mailing list:

http://www.scipy.org/Mailing_Lists

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.