Re: [Numpy-discussion] Stacking a 2d array onto a 3d array

2010-10-28 Thread Anne Archibald
On 26 October 2010 21:02, Dewald Pieterse dewald.piete...@gmail.com wrote: I see my slicing was the problem, np.vstack((test[:1], test)) works perfectly. Yes and no. np.newaxis (or None for short) is a very useful tool; you just stick it in an index expression and it adds an axis of length one

[Numpy-discussion] Stacking a 2d array onto a 3d array

2010-10-26 Thread Dewald Pieterse
Starting with: In [93]: test = numpy.array([[[1,1,1],[1,1,1]],[[2,2,2],[2,2,2]],[[3,3,3],[3,3,3]]]) In [94]: test Out[94]: array([[[1, 1, 1], [1, 1, 1]], [[2, 2, 2], [2, 2, 2]], [[3, 3, 3], [3, 3, 3]]]) Slicing the complete first row: In [95]:

Re: [Numpy-discussion] Stacking a 2d array onto a 3d array

2010-10-26 Thread josef . pktd
On Tue, Oct 26, 2010 at 8:15 PM, Dewald Pieterse dewald.piete...@gmail.com wrote: Starting with: In [93]: test = numpy.array([[[1,1,1],[1,1,1]],[[2,2,2],[2,2,2]],[[3,3,3],[3,3,3]]]) In [94]: test Out[94]: array([[[1, 1, 1],     [1, 1, 1]],    [[2, 2, 2],     [2, 2, 2]],   

Re: [Numpy-discussion] Stacking a 2d array onto a 3d array

2010-10-26 Thread Dewald Pieterse
I see my slicing was the problem, np.vstack((test[:1], test)) works perfectly. On Wed, Oct 27, 2010 at 12:55 AM, josef.p...@gmail.com wrote: On Tue, Oct 26, 2010 at 8:15 PM, Dewald Pieterse dewald.piete...@gmail.com wrote: Starting with: In [93]: test =