Hi, Robert, Thanks a lot.
I figure it out, too. NumArray is so flexible, it's like cutting the cheese. You can cut it anyway you want. I really like NumArray. --- Robert Kern <[EMAIL PROTECTED]> wrote: > Anthony Liu wrote: > > I am using numarray. > > I will be using numpy for this post, and if you are > new to numarray, then you > should probably skip it and use numpy instead. All > new development is going > towards numpy. > > http://numeric.scipy.org/ > > > Suppose I have > > > >>>>p = array(range(25), shape=(5,5)) > >>>>p > > > > array([[ 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]]) > > In [4]: from numpy import * > > In [5]: p = arange(25).reshape((5,5)) > > In [6]: p > Out[6]: > array([[ 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]]) > > > How do I easily slice out [0,1,2] > > In [7]: p[0, :3] > Out[7]: array([0, 1, 2]) > > > or [1,2,3] > > In [9]: p[0, 1:4] > Out[9]: array([1, 2, 3]) > > > or [2,7,12] > > In [10]: p[:3, 2] > Out[10]: array([ 2, 7, 12]) > > > or [7,12,17] and put it in a list? > > In [11]: p[1:4, 2] > Out[11]: array([ 7, 12, 17]) > > -- > Robert Kern > [EMAIL PROTECTED] > > "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 > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list