I want to print the whole matrix. When I print X it tells me location where values are stored expcept zeros. Can I print whole matrix including zeros?
X = sparse.csr_matrix(1./2.*np.array([[0.,1.],[1.,0.]]))
print(X)
You can convert the sparse matrix to dense (i.e. regular numpy matrix) and then print the dense representation. For this use the method todense.
Sample code:
X = sparse.csr_matrix(1./2.*np.array([[0.,1.],[1.,0.]]))
a = X.todense()
print(a)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With