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 understanding anything, this seems to work: jo...@johan-laptop:~$ python Python 2.5.4 (r254:67916, Feb 18 2009, 03:00:47) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import numpy as np >>> a = np.array([1, 2, 3]) >>> b = np.zeros((5, 3)) >>> b[:, :] = a >>> b array([[ 1., 2., 3.], [ 1., 2., 3.], [ 1., 2., 3.], [ 1., 2., 3.], [ 1., 2., 3.]]) Hope it helps / johan _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion