Answers for "csr_matrix to numpy array"

0

csr_matric scipy lib

>>> import numpy as np
>>> from scipy.sparse import csr_matrix
>>> csr_matrix((3, 4), dtype=np.int8).toarray()
array([[0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0]], dtype=int8)
Posted by: Guest on September-21-2020
0

convert ndarray to csr_matrix

sparse_csr_mat = sparse.csr_matrix(an_array)
Posted by: Guest on May-25-2021

Python Answers by Framework

Browse Popular Code Answers by Language