[Numpy-discussion] concatenate and different numbers of dimensions

Torgil Svensson torgil.svensson@gmail....
Mon Feb 12 18:02:15 CST 2007


As the error-message say, they must match number of dimensions, try:
concatenate((tempLevel, temp[newaxis,...]), axis=0)

On 2/13/07, Evan Mason <evanmason@gmail.com> wrote:
> Hi, I am trying to use concatenate to join together a 40x50x45 array and a
> 50x45 array.  The shape of the resulting array should be 41x50x45.
>
> In [132]: tempLevel.shape
> Out[132]: (40, 50, 45)
>
> In [133]: temp.shape
> Out[133]: (50, 45)
>
> I've tried various ways to do this using concatenate but always get the
> following:
>
> In [142]: concatenate((tempLevel, temp), axis=0)
> ---------------------------------------------------------------------------
> exceptions.ValueError                                Traceback (most recent
> call last)
>
> /home/emason/python/tools/<ipython console>
>
> ValueError: arrays must have same number of dimensions
>
>
>  How do I do this with concatenate, or is there another way to do it?
>
> Many thanks, Evan
>
>
>
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>


More information about the Numpy-discussion mailing list