a = np.empty(3*n.size, np.int)
a[::3]=n
a[1::3]=m
a[2::3]=o
or
np.array(zip(n,m,o)).ravel()
but the first solution is faster, even if you have to write more :D
Emmanuelle
On Sun, Jun 14, 2009 at 04:11:29PM +0200, Robert wrote:
> whats the right way to efficiently weave arrays like this ? :
whats the right way to efficiently weave arrays like this ? :
>>> n
array([1, 2, 3, 4])
>>> m
array([11, 22, 33, 44])
>>> o
array([111, 222, 333, 444])
=>
[ 1, 11, 111, 2, 22, 222, 3, 33, 333, 4, 44, 444]
___
Numpy-discussion mailing li