Data type not understood

I am trying to use a matrix to calculate material. Code is

import numpy as np # some code mmatrix = np.zeros(nrows, ncols) print mmatrix[0, 0] 

but I get the "data type incomprehensible" and it works if I do it from the terminal.

+42
python numpy matrix
Mar 27 '11 at 1:10
source share
1 answer

Try:

 mmatrix = np.zeros((nrows, ncols)) 

Because the form parameter must be an int or sequence of ints

http://docs.scipy.org/doc/numpy/reference/generated/numpy.zeros.html

Otherwise, you pass ncols to np.zeros as dtype.

+63
Mar 27 '11 at 1:24
source share



All Articles