SciPy - Sparse Matrices (scipy.sparse)
What will be the output of this code?
import numpy as np from scipy.sparse import coo_matrix row = np.array([0, 1, 2]) col = np.array([1, 2, 0]) data = np.array([4, 5, 6]) sparse_mat = coo_matrix((data, (row, col)), shape=(3, 3)) print(sparse_mat.toarray())
