[問題] scipy spdiags

看板Python作者 (jigfopsda)時間12年前 (2011/10/23 22:22), 編輯推噓0(002)
留言2則, 1人參與, 最新討論串1/2 (看更多)
http://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.spdiags.html 我照這網站上的範例打結果出現錯誤@@ >>> from scipy import * >>> data = array([[1,2,3,4],[1,2,3,4],[1,2,3,4]]) >>> diags = array([0,-1,2]) >>> spdiags(data, diags, 4, 4).todense() Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> spdiags(data, diags, 4, 4).todense() NameError: name 'spdiags' is not defined 有import了應該是不會發生這種事情吧(?) 請問可能會是什麼問題呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.73.242.151

10/23 23:51, , 1F
from scipy import sparse
10/23 23:51, 1F

10/23 23:52, , 2F
sparse.spdiags
10/23 23:52, 2F
文章代碼(AID): #1Ef2CHxf (Python)
討論串 (同標題文章)
文章代碼(AID): #1Ef2CHxf (Python)