1

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

1 Answer 1

1

Umut, could you provide a code snippet? The following works for me:

import scipy.sparse as sparse x = sparse.csr_matrix([[1,0,1],[0,1,0]]) x.nonzero() 

and yields

(array([0, 0, 1], dtype=int32), array([0, 2, 1], dtype=int32)) 

This is for the latest development version of scipy (you can check by printing scipy.__version__).

Sign up to request clarification or add additional context in comments.

1 Comment

Hmm Thanks Stefan, I installed SciPy and NumPy from Debian repositories and the version is >>> scipy.__version__ '0.6.0' I guess that is the problem. I see also the comment from J.F.Sebastian that it works for 0.7.0 so it seems that this functionality is not available in my version

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.