title: Check Density of a Scipy Sparse Matrix
body: <p>Is there a good way to measure or check the density of a scipy.sparse matrix?</p>
  
  <p>For example:</p>
  
  <pre><code>import scipy.sparse
  import numpy as np
  
  row  = np.array([0,3,1,0])
  col  = np.array([0,3,1,2])
  data = np.array([4,5,7,9])
  
  mat = scipy.sparse.coo_matrix((data,(row,col)), shape=(4,4))
  print mat.todense()
  
  [[4 0 9 0]
   [0 7 0 0]
   [0 0 0 0]
   [0 0 0 5]]
  </code></pre>
  
  <p>Maybe return something that gives me the general statistics for the overall density like average occupancy per row (i.e., first row occupies 2/4 values, second row occupies 1/4, third row occupies 0/4, and fourth row occupies 1/4 and so the average occupancy/density would be 1/4), stddev, variance, etc. Perhaps there's a better density metric that one could apply that is not dependent on the size of the matrix (assuming that it is sufficiently large).</p>