def nonzeros(m, row):
    """ returns the non zeroes of a row in csr_matrix """
    for index in range(m.indptr[row], m.indptr[row+1]):
        yield m.indices[index], m.data[index]
def nonzeros ( m , row ) : for index in range ( m . indptr [ row ] , m . indptr [ row + 1 ] ) : yield m . indices [ index ] , m . data [ index ]
returns the non zeroes of a row in csr_matrix