[Numpy-discussion] rollaxis

Pierre GM pgmdevlist at gmail.com
Wed Dec 13 16:44:35 EST 2006


On Wednesday 13 December 2006 15:29, A. M. Archibald wrote:

> Generate an axis-permutation tuple and use transpose:

Ah OK. It took me a little while to get it running: instead of 
s=list(A.shape)
in your example, one should read 
s=range(A.ndim)

But it does the trick, thanks a lot!

And now, double or nothing:
Samething, but with rows or columns:
For example, put a 5th column in the far right, without modifying the relative 
positions of the others.
Thanks in advance !



More information about the NumPy-Discussion mailing list