scipy/scipy — pull request #3247 by jnothman (2014-01-28 00:13:19+00:00)
Title: ENH function to return nnz per row/column in some sparse matrices

I often use `np.diff(mat.indptr)` to get the number of nonzeros in each row of a CSR or each column of a CSC. `bincount` can be used for the minor axis. Reading these expressions is unfriendly and un-polymorphic, so I propose a method to get `nnz` by axis. This PR overloads `getnnz` to that purpose in those matrices where appropriate.