[Numpy-discussion] What am I missing about concatenate?
Alexandre Fayolle
alexandre.fayolle at logilab.fr
Thu Jun 1 11:45:02 CDT 2006
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)
> array. I thought one of these would work:
>
> >>> N.concatenate(((1,2),(3,4)),0)
> array([1, 2, 3, 4])
> >>> N.concatenate(((1,2),(3,4)),1)
> array([1, 2, 3, 4])
>
> Is this the best I can do?
>
> >>> N.concatenate(((1,2),(3,4))).reshape(2,2)
> array([[1, 2],
> [3, 4]])
>
> 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.
a1 = array([1,2])
a2 = array([3,4])
print array([a1, a2])
/bin/bash: q: command not found
--
Alexandre Fayolle LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
Informatique scientifique: http://www.logilab.fr/science
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 481 bytes
Desc: Digital signature
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060601/3ae6bd09/attachment-0001.bin
More information about the Numpy-discussion
mailing list