I am trying to create a sparse matrix by reading the documentation.
So, according to the documentation (https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.html):
When I try:
csr_matrix((data = np.array([1, 1, 1, 1, 1, 1]), indices = np.array(2, 3, 4, 5, 7, 7), indptr = np.array([0, 1, 2, 3, 2, 1])))
I get an exception:
File "", line 1 csr_matrix((data = np.array([1, 1, 1, 1, 1, 1]), indices = np.array(2, 3, 4, 5, 7, 7), indptr = np.array([0, 1, 2, 3, 2, 1]))) ^ SyntaxError: invalid syntax
When I try:
csr_matrix((np.array([1, 1, 1, 1, 1, 1]), np.array(2, 3, 4, 5, 7, 7), np.array([0, 1, 2, 3, 2, 1])))
again an error message results:
ValueError: only 2 non-keyword arguments accepted
My intention here is to create a matrix which has ones in the columns with indexes
2, 3, 4, 5, 7, 7
where the corresponding rows have indexes
0, 1, 2, 3, 2, 1
(i.e., (0, 2) , (1, 3) , (2, 4) etc).

np.array(1,2,3)is not going to work). Grab the docs of all the functions involved, includingnp.array(). - sascha