[Numpy-discussion] Re: What am I missing about concatenate? (original) (raw)
Robert Kern robert.kern at gmail.com
Thu Jun 1 11:43:00 EDT 2006
- Previous message (by thread): [Numpy-discussion] What am I missing about concatenate?
- Next message (by thread): [Numpy-discussion] Re: What am I missing about concatenate?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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?
Yes.
Look at vstack() (and also its friends hstack(), dstack() and column_stack() for completeness).
-- Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
- Previous message (by thread): [Numpy-discussion] What am I missing about concatenate?
- Next message (by thread): [Numpy-discussion] Re: What am I missing about concatenate?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]