Slide 19
Slide 19 text
Sebastian Raschka & Andreas Mueller!
Scipy Sparse Matrices!
19!
>>> from scipy import sparse
>>> mtx = sparse.lil_matrix([[0, 1, 2, 0],
... [3, 0, 1, 0],
... [1, 0, 0, 1]])
>>> print(mtx)
(0, 1) 1
(0, 2) 2
(1, 0) 3
(1, 2) 1
(2, 0) 1
(2, 3) 1
>>> print(mtx.toarray())
[[0 1 2 0]
[3 0 1 0]
[1 0 0 1]]
List of Lists (LIL) example!