July 2014 |
|
September 2014 |
For a long opinionated discussion see this thread on Stack Overflow.
from scipy.sparse import csr_matrix A = csr_matrix([[1,0,2],[0,3,0]]) >>>A <2x3 sparse matrix of type '<type 'numpy.int64'>' with 3 stored elements in Compressed Sparse Row format >>> A.todense() matrix([[1, 0, 2], [0, 3, 0]]) >>> A.toarray() array([[1, 0, 2], [0, 3, 0]])