[Tutor] [Python2.7] Convert (2,188,1) into (188,1)
Albert-Jan Roskam
sjeik_appie at hotmail.com
Tue Jul 4 05:46:01 EDT 2017
________________________________________
From: Tutor [tutor-bounces+sjeik_appie=hotmail.com at python.org] on behalf of Alan Gauld via Tutor [tutor at python.org]
Sent: Tuesday, July 4, 2017 8:37 AM
To: tutor at python.org
Subject: Re: [Tutor] [Python2.7] Convert (2,188,1) into (188,1)
On 28/06/17 16:48, Allan Tanaka via Tutor wrote:
> Hi. I have array shape like: (2,188,1).
I assume this is a numpy array rather than the standard
library array? If so consider asking on the scipy/numpy
support forum for more specialised help.
> I want to make it like this: (188,1). I try that
> using .reshape(188,1)
Assuming this is a numpy array: If you want a 1D array you can use ravel (faster) or flatten (better name IMHO): https://docs.scipy.org/doc/numpy/reference/generated/numpy.ravel.html
arr.reshape(2*188, 1) may also work.
More information about the Tutor
mailing list