Re: [Numpy-discussion] howto make from flat array (1-dim) 2-dimensional?

2007-05-14 Thread Christopher Barker
or: a=array([1,2,3]).reshape((-1,1)) Darn, I guess there is more than one obvious way to do it! -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115

[Numpy-discussion] howto make from flat array (1-dim) 2-dimensional?

2007-05-13 Thread dmitrey
i.e. for example from flat array [1, 2, 3] obtain array([[ 1.], [ 2.], [ 3.]]) I have numpy v 1.0.1 Thx, D. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] howto make from flat array (1-dim) 2-dimensional?

2007-05-13 Thread David M. Cooke
On Sun, May 13, 2007 at 02:36:39PM +0300, dmitrey wrote: i.e. for example from flat array [1, 2, 3] obtain array([[ 1.], [ 2.], [ 3.]]) I have numpy v 1.0.1 Thx, D. Use newaxis: In [1]: a = array([1., 2., 3.]) In [2]: a Out[2]: array([ 1., 2., 3.]) In [3]: a[:,newaxis]

Re: [Numpy-discussion] howto make from flat array (1-dim) 2-dimensional?

2007-05-13 Thread Darren Dale
On Sunday 13 May 2007 7:36:39 am dmitrey wrote: i.e. for example from flat array [1, 2, 3] obtain array([[ 1.], [ 2.], [ 3.]]) a=array([1,2,3]) a.shape=(len(a),1) ___ Numpy-discussion mailing list Numpy-discussion@scipy.org

Re: [Numpy-discussion] howto make from flat array (1-dim) 2-dimensional?

2007-05-13 Thread Stefan van der Walt
On Sun, May 13, 2007 at 07:46:47AM -0400, Darren Dale wrote: On Sunday 13 May 2007 7:36:39 am dmitrey wrote: i.e. for example from flat array [1, 2, 3] obtain array([[ 1.], [ 2.], [ 3.]]) a=array([1,2,3]) a.shape=(len(a),1) Or just a.shape = (-1,1) Cheers Stéfan