1. 合并多个稀疏矩阵
横向合并: scipy.sparse.hstack
纵向合并: scipy.sparse.vstack
Code Example:
>>> from scipy.sparse import hstack,vstack,csc_matrix
>>> import numpy as np
>>> X = csc_matrix(np.arange(4).reshape(2, 2))
>>> X.toarray()
array([[0, 1],
[2, 3]])
>>> Y = csc_matrix(np.arange(4, 8).reshape(2, 2))
>>> Y.toarray()
array([[4, 5],
[6, 7]])
>>> hstack((X, Y)).toarray()
array([[0, 1, 4, 5],
[2, 3, 6, 7]])
>>> vstack((X, Y)).toarray()
array([[0, 1],
[2, 3],
[4, 5],
[6, 7]])