Re: concatenating numpy arrays
- From: "Travis E. Oliphant" <oliphant.travis@xxxxxxxx>
- Date: Tue, 31 Oct 2006 05:48:25 -0700
Rolf Wester wrote:
Hi,
I want to concatenate two numpy arrays with shape (n1,n2) and (n1,n3) into a single array with shape (n1,n2+n3). I guess there is an elegant way to do this but I couldn't figure it out. So any help is very much appreciated.
Suppose a1.shape is (n1,n2)
and a2.shape is (n1,n3)
Then you want to do
a3 = concatenate((a1,a2),axis=1)
or equivalently
a3 = hstack([a1,a2])
a3 = r_['1',a1,a2]
-Travis
.
- References:
- concatenating numpy arrays
- From: Rolf Wester
- concatenating numpy arrays
- Prev by Date: Re: Python tools for managing static websites?
- Next by Date: Re: Printing out the objects stack
- Previous by thread: concatenating numpy arrays
- Next by thread: Python tools for managing static websites?
- Index(es):