coo_matrix.tocsr(copy = False ) 将此矩阵转换为压缩稀疏行格式,重复的条目将汇总在一起. 举例: from numpy import array from scipy.sparse import coo_matrix row = array([0, 0, 1, 3, 1, 0, 0]) col = array([0, 2, 1, 3, 1, 0, 0]) data = array([1, 1, 1, 1, 1, 1, 1]) A = coo_matrix((data