【发布时间】:2013-09-16 03:51:12
【问题描述】:
谁能告诉我如何加入两个不相等的 numpy 数组(一个稀疏和一个密集)。我尝试使用 hstack/vstack,但不断收到维度错误。
from scipy import sparse
from scipy.sparse import coo_matrix
m=(coo_matrix(X_new)) # is a(7395,50000) sparse array
a=(other) # is a (7395,20) dense array
new_tr=scipy.sparse.hstack((m,a))
【问题讨论】:
-
你能出示你的代码吗?
-
from scipy import sparse from scipy.sparse import coo_matrix m=(coo_matrix(X_new)) # is a(7395,50000) sparse array a=(other) # is a (7395,20) dense数组 new_tr=scipy.sparse.hstack((m,a))
-
请在您的问题中粘贴并格式化您的代码。
标签: python arrays numpy matrix scipy