Rakesh Singh
Rakesh Singh

Reputation: 3

ModuleNotFoundError: No module named 'sklearn.compose'

I am trying to import this

from sklearn.compose import ColumnTransformer

but getting the error:

ModuleNotFoundError: No module named 'sklearn.compose'

My scikit-learn package version is 0.19.1 in anaconda.

Upvotes: 0

Views: 10493

Answers (1)

desertnaut
desertnaut

Reputation: 60399

sklearn.compose is not available in scikit-learn v0.19; it was introduced in v0.20. From the docs:

New in version 0.20.

You can also confirm from the list of modules for v0.19 that there is not a sklearn.compose module.

You should upgrade to the latest scikit-learn version (currently 0.20.3) by running

conda install -c conda-forge scikit-learn

from your command prompt (see the package page at Anaconda cloud or the SO thread How to upgrade scikit-learn package in anaconda for more options).

Upvotes: 5

Related Questions