[Tutor] [Python2.7] Convert (2,188,1) into (188,1)

Alan Gauld alan.gauld at yahoo.co.uk
Tue Jul 4 04:37:46 EDT 2017


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) 

.reshape() is not a valid function name. What object
are you attaching it to?

Show us at least a code snippet so we don't need
to guess. We need to see how you create the initial
array, then how you try to use reshape. Ideally a short
but complete example that exhibits the problem.

> but throws an error: total size of an array must be unchanged

Show us the full error trace, they contain a lot of information.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list