def find(A):

    A = coo_matrix(A, copy=True)
    A.sum_duplicates()
    # remove explicit zeros
    nz_mask = A.data != 0
    return A.row[nz_mask], A.col[nz_mask], A.data[nz_mask]
Return the indices and values of the nonzero elements of a matrix
dataset/ETHPy150Open scipy/scipy/scipy/sparse/extract.py/find