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
Post a Comment