1 csr_matrix默認對未填充的位置置為0,
row = [0, 0, 0, 1, 1, 1, 2, 2, 2] # 行指標 col = [0, 1, 2, 0, 1, 2, 0, 1, 2] # 列指標 data = [1, 0, 1, 0, 1, 1, 1, 1, 0] # 在行指標列指標下的數字 team = csr_matrix((data, (row, col)), shape=(3, 3)) print(team) print(team.todense()) #todense()與toarray()的效果一樣,都是將矩陣輸出. print(team.toarray())
https://blog.csdn.net/chao2016/article/details/80344828