Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

data type not understood

I'm trying to use a matrix to compute stuff. The code is this

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

but I get 'data type not understood', and it works if I do it from terminal.

like image 452
Bob Avatar asked Mar 27 '11 01:03

Bob


1 Answers

Try:

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

Since the shape parameter has to be an int or sequence of ints

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

Otherwise you are passing ncols to np.zeros as the dtype.

like image 96
JoshAdel Avatar answered Sep 27 '22 20:09

JoshAdel