title: How to efficiently store variable number of scipy sparse.csr_matrix in memory?
body: <p>I have around 10,000 sparse matrices each with size 50,000x5 with 0.0004 density on average.
  For each loop (10000 times), I'm calculating numpy array and converting it into csr_matrix and appending that to a list. But memory consumption is as high as appending numpy arrays but not as appending csr_matrices.</p>
  
  <p>How to reduce the memory consumption while having these 10K sparse matrices in memory for further computations?</p>
  
  <p>Sample code:  </p>
  
  <pre><code>from scipy.sparse import csr_matrix
  import numpy as np
  sparse_matrices = []
  
  for i in range(10000):
      np_array = get_np_array()
      sparse_matrix = csr_matrix(np_array)
      sparse_matrices.append(sparse_matrix)
      print np_array.nbytes, sparse_matrix.data.nbytes, repr(sparse_matrix)
  </code></pre>
  
  <p>Would outputs something similar which makes it clear that I'm appending compressed matrices. But still, the memory grows as same as appending numpy matrices.</p>
  
  <pre><code>1987520 520 &lt;49688x5 sparse matrix of type '&lt;type 'numpy.float64'&gt;'
      with 65 stored elements in Compressed Sparse Row format&gt;
  1987520 512 &lt;49688x5 sparse matrix of type '&lt;type 'numpy.float64'&gt;'
      with 64 stored elements in Compressed Sparse Row format&gt;
  </code></pre>
  
  <hr>
  
  <p>Just realised that if I use <code>coo_matrix</code> instead of <code>csr_matrix</code>, memory consumption is reasonable. If that is <code>csr_matrix</code> memory's around ~8gb.</p>