I have followed various tutorials using the sklearn toolkit to transform text into a vector for a machine learning model I am building. I keep getting this error with my code:
This is my code:
from sklearn.feature_extraction.text import CountVectorizer
vectorizer = CountVectorizer()
X = vectorizer.fit_transform(anon_words)
print(vectorizer.get_feature_names())
print(X.toarray)
I think it is because my data is in a list because I've done lots of pre-processing on it?
Here is an image of the output of my text from the previous step: Text following pre-processing