Re: [Numpy-discussion] Create 2D array from EXISTING 1D array

2009-09-14 Thread Charles R Harris
On Mon, Sep 14, 2009 at 4:46 AM, Ruben Salvador wrote: > Hi there! > > It's a time since I'm asking this question to myself, and still don't know > a Pythonic way to solve it. I want to create a 2D array where each *row* is > a copy of an already existing 1D array. For example: > > In [21]: a = np

Re: [Numpy-discussion] Create 2D array from EXISTING 1D array

2009-09-14 Thread Ruben Salvador
Perfect, that's exactly what I need! Somehow I missed this routine when checking documentation :S In [58]: a Out[58]: array([1, 2, 3]) In [59]: np.tile(a, (5,1)) Out[59]: array([[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]) Thanks a lot! On Mon, Sep 14, 2009 at 1:07 PM, Citi, Luca wr

Re: [Numpy-discussion] Create 2D array from EXISTING 1D array

2009-09-14 Thread Citi, Luca
if I get your question correctly, np.tile could be what you need ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Create 2D array from EXISTING 1D array

2009-09-14 Thread Johan Grönqvist
Ruben Salvador skrev: > [...] I want to create a 2D array where each > *row* is a copy of an already existing 1D array. For example: > In [25]: a > Out[25]: array([1, 2, 3]) > [...] > In [30]: b > Out[30]: > array([[1, 2, 3], > [1, 2, 3], > [1, 2, 3], > [1, 2, 3], > [1, 2, 3]]) > Without unders

[Numpy-discussion] Create 2D array from EXISTING 1D array

2009-09-14 Thread Ruben Salvador
Hi there! It's a time since I'm asking this question to myself, and still don't know a Pythonic way to solve it. I want to create a 2D array where each *row* is a copy of an already existing 1D array. For example: In [21]: a = np.array[1, 2, 3] In [25]: a Out[25]: array([1, 2, 3]) To create a 2D