scipy.sparse 矩阵中 csr_matrix 中的非零值
scipy 库的 csr_matrix 有一个 nonzero() 方法,但是尝试将该函数用于 csr 矩阵会导致错误,根据手册应返回带有行和列数组的元组。关于这个问题有什么想法吗?
此致, 乌穆特
There is a nonzero() method for the csr_matrix of scipy library, however trying to use that function for csr matrices result in an error, according to the manual that should return a tuple with row and colum arrays. Any ideas on this problem?
Best regards,
Umut
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Umut,你能提供一个代码片段吗?以下内容对我有用:
并产生
这是 scipy 的最新开发版本(您可以通过打印
scipy.__version__
进行检查)。Umut, could you provide a code snippet? The following works for me:
and yields
This is for the latest development version of scipy (you can check by printing
scipy.__version__
).