> red=c3_r.reshape(c3,shape) > TypeError: only length-1 arrays can be converted to Python scalars I assume you want red = c3_r.reshape(c3.shape) ? The method signature for the reshape method of numpy.ndarray is: ndarray.reshape(shape, order='C')