question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pandas 1.0.0rc0/0.6.1 module 'sklearn.preprocessing' has no attribute 'Imputer'

See original GitHub issue

SKLEARN

sklearn.preprocessing.Imputer Warning DEPRECATED

class sklearn.preprocessing.Imputer(*args, **kwargs)[source] Imputation transformer for completing missing values.

Read more in the User Guide.


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-e0471065d85c> in <module>
      1 import pandas as pd
      2 import numpy as np
----> 3 import pandas_ml as pdml
      4 a1 = np.random.randint(0,2,size=(100,2))
      5 df = pd.DataFrame(a1,columns=['i1','i2'])

C:\g\test\lib\pandas_ml\__init__.py in <module>
      1 #!/usr/bin/env python
      2 
----> 3 from pandas_ml.core import ModelFrame, ModelSeries       # noqa
      4 from pandas_ml.tools import info                         # noqa
      5 from pandas_ml.version import version as __version__     # noqa

C:\g\test\lib\pandas_ml\core\__init__.py in <module>
      1 #!/usr/bin/env python
      2 
----> 3 from pandas_ml.core.frame import ModelFrame       # noqa
      4 from pandas_ml.core.series import ModelSeries     # noqa

C:\g\test\lib\pandas_ml\core\frame.py in <module>
      8 
      9 import pandas_ml.imbaccessors as imbaccessors
---> 10 import pandas_ml.skaccessors as skaccessors
     11 import pandas_ml.smaccessors as smaccessors
     12 import pandas_ml.snsaccessors as snsaccessors

C:\g\test\lib\pandas_ml\skaccessors\__init__.py in <module>
     17 from pandas_ml.skaccessors.neighbors import NeighborsMethods                      # noqa
     18 from pandas_ml.skaccessors.pipeline import PipelineMethods                        # noqa
---> 19 from pandas_ml.skaccessors.preprocessing import PreprocessingMethods              # noqa
     20 from pandas_ml.skaccessors.svm import SVMMethods                                  # noqa

C:\g\test\lib\pandas_ml\skaccessors\preprocessing.py in <module>
     11     _keep_col_classes = [pp.Binarizer,
     12                          pp.FunctionTransformer,
---> 13                          pp.Imputer,
     14                          pp.KernelCenterer,
     15                          pp.LabelEncoder,

AttributeError: module 'sklearn.preprocessing' has no attribute 'Imputer'

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:10
  • Comments:11

github_iconTop GitHub Comments

4reactions
olliiivercommented, Apr 7, 2020

Had the same problem while trying some examples and Google brought me here.

sklearn.preprocessing.Imputer has been removed in 0.22.

Needed to downgrade.

pip3 install scikit-learn==0.21

pip3 install pandas==0.24.2

2reactions
kalilamalicommented, May 10, 2020

This worked for me: You have to uninstall properly and downgrading will work.

! pip uninstall -y scikit-learn ! pip uninstall -y pandas ! pip uninstall -y pandas_ml

! pip install scikit-learn==0.21 ! pip install pandas==0.24.2 ! pip install pandas_ml

import pandas_ml as pdml

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot import name 'Imputer' from 'sklearn.preprocessing ...
I am using Conda, I have my own env with all the packages, I have tried to install older versions of sklearn and...
Read more >
sklearn.impute.SimpleImputer
Univariate imputer for completing missing values with simple strategies. ... New in version 0.20: SimpleImputer replaces the previous sklearn.preprocessing.
Read more >
6.4. Imputation of missing values - Scikit-learn
The SimpleImputer class provides basic strategies for imputing missing values. Missing values can be imputed with a provided constant value, ...
Read more >
sklearn.impute.KNNImputer — scikit-learn 1.1.3 documentation
For pandas' dataframes with nullable integer dtypes with missing values, ... If a feature has no missing values at fit/train time, the feature...
Read more >
sklearn.impute.IterativeImputer
Multivariate imputer that estimates each feature from all the others. A strategy for imputing missing values by modeling each feature with missing values...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found