bkieler
bkieler

Reputation: 38

Receive ImportError: cannot import name 'DictVectorizer'

I have installed scikit-learn to a python environment through Anaconda. This is on Ubuntu 14.04. The line in my code it is complaining about is

from sklearn.feature_extraction.text import DictVectorizer

The error is

Import Error: cannot import name 'DictVectorizer'

I have tried uninstalling and reinstalling both using Conda and then with Pip. The install succeeds with no error no matter how I install it.

If I start a python command line and type the import, no errors are given.

Would anyone have any suggestions for how to be able to import the DictVectorizer in my code?

Upvotes: 1

Views: 794

Answers (1)

John
John

Reputation: 5206

I'm unfamiliar with that library. However, looking at the source on github it appears you have the import path wrong.

from sklearn.feature_extraction import DictVectorizer should work

Upvotes: 2

Related Questions