Re: [Numpy-discussion] basic question about numpy arrays

2010-08-16 Thread Rob Speer
To explain: A has shape (2,1), meaning it's a 2-D array with 2 rows and 1 column. The transpose of A has shape (1,2): it's a 2-D array with 1 row and 2 columns. That's not the same as what you want, which is an array with shape (2,): a 1-D array with 2 entries. When you take A[:,0], you're pullin

Re: [Numpy-discussion] basic question about numpy arrays

2010-08-16 Thread John Salvatier
You can also do: y = x[:,0] On Mon, Aug 16, 2010 at 11:28 AM, Skipper Seabold wrote: > On Mon, Aug 16, 2010 at 2:25 PM, gerardob wrote: > > > > I have a numpy array A , such that when i print A it appears: > > > > [[ 10.] > > [ 20.]] > > > > I would like to have a one dimensional array B (obta

Re: [Numpy-discussion] basic question about numpy arrays

2010-08-16 Thread Skipper Seabold
On Mon, Aug 16, 2010 at 2:25 PM, gerardob wrote: > > I have a numpy array A , such that when i print A it appears: > > [[ 10.] >  [ 20.]] > > I would like to have a one dimensional array B (obtained from A) such that > B[0] = 10 and B[1]=20. It could be seen as the transpose of A. > > How can i ob

[Numpy-discussion] basic question about numpy arrays

2010-08-16 Thread gerardob
I have a numpy array A , such that when i print A it appears: [[ 10.] [ 20.]] I would like to have a one dimensional array B (obtained from A) such that B[0] = 10 and B[1]=20. It could be seen as the transpose of A. How can i obtain B = [10,20] from A? I tried transpose(1,0) but it doesn't se