Посмотрите на небольшой пример:
In [458]: rows=np.arange(5); cols=rows; data = np.ones(len(rows), int)
In [459]: M = sparse.coo_matrix((data, (rows, cols)))
In [460]: M
Out[460]:
<5x5 sparse matrix of type '<class 'numpy.int64'>'
with 5 stored elements in COOrdinate format>
In [461]: max(rows)
Out[461]: 4
In [463]: M.row
Out[463]: array([0, 1, 2, 3, 4], dtype=int32)
In [464]: print(M)
(0, 0) 1
(1, 1) 1
(2, 2) 1
(3, 3) 1
(4, 4) 1
In [465]: M.A
Out[465]:
array([[1, 0, 0, 0, 0],
[0, 1, 0, 0, 0],
[0, 0, 1, 0, 0],
[0, 0, 0, 1, 0],
[0, 0, 0, 0, 1]])