There is also np.squeeze(), which will eliminate any singleton dimensions
(but I personally hate using it because it can accidentally squeeze out
dimensions that you didn't intend to squeeze when you have arbitrary input
data).

Ben Root


On Wed, Aug 27, 2014 at 11:12 AM, Wagner Sebastian <
sebastian.wagner...@ait.ac.at> wrote:

>  Hi,
>
>
>
> Our short example-data:
>
> >>> np.arange(10).reshape(1,5,2)
>
> array([[[0, 1],
>
>         [2, 3],
>
>         [4, 5],
>
>         [6, 7],
>
>         [8, 9]]])
>
> Shape is (1,5,2)
>
>
>
> Two possibilies:
>
> >>> data.reshape(5,2)
>
> array([[0, 1],
>
>        [2, 3],
>
>        [4, 5],
>
>        [6, 7],
>
>        [8, 9]])
>
>
>
> Or just:
>
> >>> data[0]
>
> array([[0, 1],
>
>        [2, 3],
>
>        [4, 5],
>
>        [6, 7],
>
>        [8, 9]])
>
>
>
>
>
> *From:* numpy-discussion-boun...@scipy.org [mailto:
> numpy-discussion-boun...@scipy.org] *On Behalf Of *phinn stuart
> *Sent:* Mittwoch, 27. August 2014 17:09
> *To:* python-l...@python.org; scipy-u...@scipy.org;
> numpy-discussion@scipy.org
> *Subject:* [Numpy-discussion] Convert 3d NumPy array into 2d
>
>
>
> Hi everyone, how can I convert (1L, 480L, 1440L) shaped numpy array into
> (480L, 1440L)?
>
>
>
> Thanks in the advance.
>
>
>
> phinn
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to