On Thu, Sep 23, 2010 at 10:32 AM, Anne Archibald <[email protected]> wrote: > Just a quick correction: len(a) gives a.shape[0], while what you want > is actually len(a.shape). So: > > In [1]: a = np.zeros((2,3,4,5,6)) > > In [2]: len(a) > Out[2]: 2 > > In [8]: np.rollaxis(a,0,len(a.shape)).shape > Out[8]: (3, 4, 5, 6, 2) > > So it behaves just like insert. But "len(a.shape)" is rather > cumbersome, especially if you haven't given a a name yet:
It's available as a.ndim Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
