Re: [Numpy-discussion] 2D Arrays column operations

2007-03-29 Thread Lou Pecora
Others can correct me, but I believe the ndarrys of numpy are *not* stored like C arrays, but rather as a contiguous memory chunk (there are some exceptions, but ignore for the moment). Then along with the data is a structure that tells numpy how to "address" the array's data memory using indices

Re: [Numpy-discussion] 2D Arrays column operations

2007-03-29 Thread Simon Berube
Awww, this is quite right. I kept using the a[0][:] notation and I assume I am simply pulling out single arrays from the array "list". Thank you very much for the prompt reply. (And sorry for wasting your time :P) On Mar 29, 3:46 pm, Travis Oliphant <[EMAIL PROTECTED]> wrote: > Simon Berube wrote

Re: [Numpy-discussion] 2D Arrays column operations

2007-03-29 Thread Stefan van der Walt
On Thu, Mar 29, 2007 at 07:43:03PM -, Simon Berube wrote: > Hi, >I am relatively new to Python/NumPy switching over from Matlab and > while porting some of my matlab code for practice I ran into the > following problem. > > Assume we have a 2D Matrix such that > a = array([[1, 2, 3], >

Re: [Numpy-discussion] 2D Arrays column operations

2007-03-29 Thread Travis Oliphant
Simon Berube wrote: >c = a(:,2) to get the values array([2,5,8]) > > Actually (0-based indexing) c = a[:,1] -Travis ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] 2D Arrays column operations

2007-03-29 Thread Travis Oliphant
Simon Berube wrote: >Hi, > I am relatively new to Python/NumPy switching over from Matlab and >while porting some of my matlab code for practice I ran into the >following problem. > >Assume we have a 2D Matrix such that >a = array([[1, 2, 3], > [4, 5, 6], > [7, 8, 9]]

[Numpy-discussion] 2D Arrays column operations

2007-03-29 Thread Simon Berube
Hi, I am relatively new to Python/NumPy switching over from Matlab and while porting some of my matlab code for practice I ran into the following problem. Assume we have a 2D Matrix such that a = array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) If I want the second row I