[NUMPY] "ValueError: total size of new array must be unchanged" just on Windows

Peter Otten __peter__ at web.de
Tue Oct 11 09:56:22 EDT 2011


Paolo Zaffino wrote:

> Nobody can help me?

Add the lines

print "a=%r, b=%r, c=%r" % (a, b, c)
print "type=%s, shape=%r, size=%r" % (type(matrix), matrix.shape, 
matrix.size)

before this one

>>>> matrix = matrix.reshape(a, b, c)

and tell us what it prints both on a system where it works and where it 
doesn't.

If a, b, and c are all integers and 

a * b * c == matrix.size

try passing a tuple:

matrix = matrix.reshape((a, b, c)) # note the double parens





More information about the Python-list mailing list