Which app do I import to fix this error? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Which app do I import to fix this error? (/thread-26266.html) |
Which app do I import to fix this error? - ErnestTBass - Apr-25-2020 In the following snippet of code, I made a replacement: import pandas as pd import numpy as np from sklearn.linear_model import LinearRegression from sklearn.cross_validation import train_test_split from sklearn.preprocessing import Imputer import matplotlib.pyplot as plt %matplotlib inlineThe new code is import pandas as pd import numpy as np from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from sklearn.preprocessing import Imputer import matplotlib.pyplot as plt %matplotlib inlineI replaced cross_validation in line 4 with model selection. It worked. Now I get the following error when I run the code. Now I am confused since when I ran pip list and conda list I got that sklearn 0.0 see attached screenshot. What import app covers this function? It seems that I have sklearn 0.0 installed. That make no sense. HowdoI correct this error. Is this handled by scikit-learn? I am not sure what to do. Respectfully, ErnestTBass RE: Which app do I import to fix this error? - Jeff900 - Apr-25-2020 Are you sure Imputer exists in sklearn.preprocessing? Maybe you can have a look on the actual source code from sklearn.preprocessing. Perhaps you can find out what Imputer is supposed to be. RE: Which app do I import to fix this error? - snippsat - Apr-25-2020 After scikit-learn version 0.20. >>> from sklearn.impute import SimpleImputer >>> (Apr-25-2020, 07:50 PM)ErnestTBass Wrote: It seems that I have sklearn 0.0 installed. That make no sense. >>> from sklearn import base >>> base.__version__ '0.22.2.post1' RE: Which app do I import to fix this error? - jefsummers - Apr-25-2020 I don't think imputer is where you thing. See sklearn imputer search RE: Which app do I import to fix this error? - ErnestTBass - Apr-26-2020 Wait, now. You are saying to install a later version of sklearn and then use the syntax that you put in your post? I will give it a try. Again, what is with this sklearn version 0.0. That really makes no sense at all. How did I or someone install sklearn 0.0. That to me means that sklearn simply was not installed. Period. Respectfully, ErnestTBass RE: Which app do I import to fix this error? - jefsummers - Apr-26-2020 That would be a bad assumption. You would get an error on the import Update scikit-learn. 0.22.2 is the current stable version. RE: Which app do I import to fix this error? - snippsat - Apr-26-2020 (Apr-26-2020, 07:48 PM)ErnestTBass Wrote: Wait, now. You are saying to install a later version of sklearn and then use the syntax that youNo you get that error because you use a never version. # This only work in older version that's why you get a error from sklearn.preprocessing import Imputer # This is what you should now in newer versions,this dos now just he same as line over from sklearn.impute import SimpleImputer ErnestTBass Wrote:Again, what is with this sklearn version 0.0. That really makes no sense at all.How dos you check to get this? I did show you how to check version. >>> from sklearn import base >>> base.__version__ '0.22.2.post1' |