Reputation: 21
CODE
import numpy as np
from sklearn.feature_extraction.text import countVectorizer
count=countVectorizer
docs=np.array(['The sun is shinning',
'The weather is sweet',
'The sun is shinning,The weather is sweet, and one and one is two'])
bag= count.fit_transform(docs)
ERROR Output
ImportError Traceback (most recent call last)
<ipython-input-1-e322748c3b4c> in <module>
1 import numpy as np
----> 2 from sklearn.feature_extraction.text import countVectorizer
3 count=countVectorizer
4 docs=np.array(['The sun is shinning',
5 'The weather is sweet',
ImportError: cannot import name 'countVectorizer' from 'sklearn.feature_extraction.text' (C:\ProgramData\Anaconda3\lib\site-packages\sklearn\feature_extraction\text.py)
statement I am getting this error help me to resolve it.I am using jupyter notebook in anaconda navigator prompt.I installed the latest version of scikit-learn but also I got the same import error. Then also installed and uninstalled the scikit-learn using Anaconda command prompt
Upvotes: 2
Views: 6773
Reputation: 336
from sklearn.feature_extraction.text import CountVectorizer
is working
Upvotes: 1