No StandardScaler class in sklearn.preprocessing

scikit-learn

Solution

The `sklearn` package in your python path is probably an old version and not the 0.13 version you installed. Try:

python -c "import sklearn; print(sklearn.__file__)"

to check whether this the expected sklearn install location or not.

To resolve duplicate installation problem I found it useful to run:

pip uninstall scikit-learn

several times until I get an error message telling explicitly that scikit-learn is not installed on the system. Then:

pip install scikit-learn

once to install the latest stable release (i.e. 0.13.1 at the time of writing).

Problem

I wanted to use the `StandardScaler` class in the preprocessing package http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.StandardScaler.html#sklearn.preprocessing.StandardScaler but I keep getting an `AttributeError: 'module' object has no attribute 'StandardScaler'` on scikit-learn 0.13 `preprocessing.__dict__` does not show `StandardScaler`. I could use the `LabelEncoder` class in the same package.

Original source