'CountVectorizer' object has no attribute 'toarray'

Viewed 380

I'm trying to vectorize some tweets so I can put it in a list and use it in a classficator.But it has a problem turn into DataFrame.enter image description here

1 Answers

You should not use toarray() method on CountVectorizer, you should use it on output of fit_transform() function to get features. This way -

cvr = CountVectorizer(...)
X = cvr.fit_transform(...)

promo_value = pd.DataFrame(X.toarray(), ...)
Related