The linked list sparse format stores the nonzero matrix entries row-wise in a list data such that data[k] is a list of the nonzero entries in row k. If all entries in that row are 0, it contains an empty list.
A second list, rows, contains at position k a list of column indexes of the nonzero elements in row k. Here is an example in row-based linked list (LIL) format:
import scipy.sparse as sp A = array([[1,0,2,0],[0,0,0,0], [3.,0.,0.,0.], [1.,0.,0.,4.]]) AS = sp.lil_matrix(A) AS.data # returns array([[1.0, 2.0], [], [3.0], [1.0, 4.0]], dtype=object) AS.rows # returns array([[0, 2], [], [0], [0, 3]], dtype=object) AS.nnz # returns 5