Saturday, 14 September 2013

sparse hstack and weird dtype conversion error

sparse hstack and weird dtype conversion error

In working with some text data, I'm trying to join an np array(from a
pandas series) to a csr matrix.
I've done the below.
#create a compatible sparse matrix from my np.array.
#sparse.csr_matrix(X['link'].values) returns array size (1,7395)
#transpose that array for (7395,1)
X = sparse.csr_matrix(X['link'].values.transpose)
#bodies is a sparse.csr_matrix with shape (7395, 20000)
bodies = sparse.hstack((bodies,X))
However, this line gives the error "no supported conversion for types:
(dtype('0'),) ". I'm not sure what this means? How do I get around it?
Thanks.

No comments:

Post a Comment