[Numpy-discussion] combining two arrays into one
Bill Baxter
wbaxter@gmail....
Tue Apr 10 08:38:27 CDT 2007
I'm pretty sure dstack([x,y]) is what you're after.
--bb
On 4/10/07, mark <markbak@gmail.com> wrote:
> Hello list -
>
> I want to combine two arrays into one, and I cannot find a clean way
> to do it.
>
> I have the following two arrays:
>
> >>> x = array([[1, 2, 3],
> [4, 5, 6]])
> >>> y = array([[10, 20, 30],
> [40, 50, 60]])
>
> Now I want to make a new array z, such that z[:,:,0] gives me x an d
> z[:,:,1] gives me y.
>
> But what do I do? This doesn't work the right way for me:
>
> >>> z = array([x,y])
> >>> z[:,:,0]
> array([[ 1, 4],
> [10, 40]])
>
> Thanks for your help,
>
> Mark
More information about the Numpy-discussion
mailing list