data = coo_matrix(data)
probably not what you want; This is an exact copy data. Not particularly rare.
What does it mean data?
I'm going to assume that you really need a matrix with most of the 0s and 1s in the coordinates represented data.
In [20]: data = [
...: [1, 0],
...: [2, 1],
...: [3, 2],
...: [4, 3]
...: ]
maybe not what you want:
In [21]: ds = sparse.coo_matrix(data)
In [22]: ds.A
Out[22]:
array([[1, 0],
[2, 1],
[3, 2],
[4, 3]])
:
In [23]: data=np.array(data)
In [24]: ds=sparse.coo_matrix((np.ones(4,int),(data[:,0],data[:,1])))
In [25]: ds
Out[25]:
<5x4 sparse matrix of type '<class 'numpy.int32'>'
with 4 stored elements in COOrdinate format>
In [26]: ds.A
Out[26]:
array([[0, 0, 0, 0],
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]])
, .