[Numpy-discussion] How to combine a pair of 1D arrays?

Peter Shinners pete@shinners....
Wed Apr 14 10:25:53 CDT 2010

Is there a way to combine two 1D arrays with the same size into a 2D 
array? It seems like the internal pointers and strides could be 
combined. My primary goal is to not make any copies of the data. It 
might be doable with a bit of ctypes if there is not a native numpy call.

 >>> import numpy as np
 >>> a = np.array((1,2,3,4))
 >>> b = np.array((11,12,13,14))
 >>> c = np.magical_fuse(a, b)   # what goes here?
 >>> print c.shape
(2, 4)
 >>> a == c[0]
 >>> a[1] = -2
 >>> a == c[0]

More information about the NumPy-Discussion mailing list