Printing matrix with numpy, python -


i want return matrix. missing?

import numpy  print matrix([[0,1],[1,1]]) 

i following error:

traceback (most recent call last):   file "fib.py", line 2, in <module>      print matrix([[0,1],[1,1]]) nameerror: name 'matrix' not defined 

you have call like:

print numpy.matrix(...) 

or (to avoid writing whole word numpy):

import numpy np  print np.matrix(...) 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -