[Numpy-discussion] What am I missing about concatenate? (original) (raw)
Alexandre Fayolle alexandre.fayolle at logilab.fr
Thu Jun 1 11:45:02 EDT 2006
- Previous message (by thread): [Numpy-discussion] Re: What am I missing about concatenate?
- Next message (by thread): [Numpy-discussion] What am I missing about concatenate?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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: signature.asc Type: application/pgp-signature Size: 481 bytes Desc: Digital signature URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20060601/3ae6bd09/attachment-0001.sig>
- Previous message (by thread): [Numpy-discussion] Re: What am I missing about concatenate?
- Next message (by thread): [Numpy-discussion] What am I missing about concatenate?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]