title: How to get indices of lil_matrix elements in a for loop?
body: <p>I created a sparse matrix using <code>scipy.sparse.lil_matrix</code>:</p>
  <pre><code>import scipy.sparse as sp
  test = sp.lil_matrix((3,3))
  test[0,0]=1
  </code></pre>
  <p>I can loop over and print the nonzero elements by doing:</p>
  <pre><code>for el in test:
      print(el)
  </code></pre>
  <p>which prints out <code>(0, 0)    1.0</code>. How do I access these two pieces of information without printing? In other words, what are the appropriate methods for the elements of <code>lil_matrix</code> that return indices and value? Doing <code>el.data</code> returns <code>array([list([])], dtype=object)</code>.</p>
  <p>Note that I'm using <code>lil_matrix</code> because I will need to assign nonzero values to it within a very large, double for loop.</p>