From: Alexandre F. <ale...@lo...> - 2006-06-01 18:44:47
|
On Thu, Jun 01, 2006 at 11:32:06AM -0700, Christopher Barker wrote: > I want to take two (2,) arrays and put them together into one (2,2)=20 > array. I thought one of these would work: >=20 > >>> N.concatenate(((1,2),(3,4)),0) > array([1, 2, 3, 4]) > >>> N.concatenate(((1,2),(3,4)),1) > array([1, 2, 3, 4]) >=20 > Is this the best I can do? >=20 > >>> N.concatenate(((1,2),(3,4))).reshape(2,2) > array([[1, 2], > [3, 4]]) >=20 > Is it because the arrays I'm putting together are rank-1? concatenate is not meant to do that. Try putting your arrays in a list and building an array from that list.=20 a1 =3D array([1,2]) a2 =3D array([3,4]) print array([a1, a2]) /bin/bash: q: command not found --=20 Alexandre Fayolle LOGILAB, Paris (France) Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations D=E9veloppement logiciel sur mesure: http://www.logilab.fr/services Informatique scientifique: http://www.logilab.fr/science |