Reputation: 2514
How can I infer the memory usage of a sparse COO format matrix
Data
row = np.array([0, 0, 1, 3, 1, 0, 0])
col = np.array([0, 2, 1, 3, 1, 0, 0])
data = np.array([1, 1, 1, 1, 1, 1, 1])
mat = coo_matrix((data, (row, col)), shape=(4, 4))
Online I found solutions that don't seem to work with coo martrices:
mat.data.nbytes + mat.indptr.nbytes + mat.indices.nbytes
only mat.data.nbytes
does not return an error, but the size is much smaller than it should be (when creating a large sparse matrix from dataframe columns). Am I missing any components here?
Upvotes: 0
Views: 409