scipy.sparse.lil_array. nonzero# lil_array.nonzero()[source]# 陣列/矩陣的非零索引。 返回一個陣列元組 (row,col),其中包含陣列的非零元素索引。 範例 在瀏覽器中試試看! >>> from scipy.sparse import csr_array >>> A = csr_array([[1, 2, 0], [0, 0, 3], [4, 0, 5]]) >>> A.nonzero() (array([0, 0, 1, 2, 2], dtype=int32), array([0, 1, 2, 0, 2], dtype=int32)) 返回在新分頁中開啟