June 1, 2006
11:43 a.m.
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