Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
scipyライブラリのcsr_matrixにはnonzero()メソッドがありますが、行と列の配列を持つタプルを返す必要があるマニュアルによると、csr行列にその関数を使用しようとするとエラーが発生します。この問題に関するアイデアはありますか?
よろしく、Umut
うーん、コードスニペットを提供してもらえますか? 以下は私にとってはうまくいきます:
import scipy.sparse as sparse x = sparse.csr_matrix([[1,0,1],[0,1,0]]) x.nonzero()
利回り
(array([0, 0, 1], dtype=int32), array([0, 2, 1], dtype=int32))
これは scipy の最新の開発バージョン用です (印刷して確認できますscipy.__version__)。
scipy.__version__