ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> numpy-discussion
numpy-discussion
Re: [Numpy-discussion] rollaxis
by A. M. Archibald other posts by this author
Dec 13 2006 12:29PM messages near this date
[Numpy-discussion] rollaxis | Re: [Numpy-discussion] rollaxis
On 13/12/06, Pierre GM <pgmdevlist@[...].com>  wrote:
>  All,
>  I have a ND array whose axes I want to reorganize, so that axis "i" is at the
>  end while the others stay in their relative position. What's the easiest ?

Generate an axis-permutation tuple and use transpose:

s = list(A.shape)
s.remove(i)
s.append(i)
B = A.transpose(s)

A. M. Archibald
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@[...].org
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Thread:
Pierre GM
A. M. Archibald
Pierre GM
Pierre GM

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved