从SciKit Learn导入make_column_selector方法时遇到麻烦。这是我的代码和产生的错误:
from sklearn.compose import ColumnTransformer
from sklearn.compose import make_column_selector
from sklearn.impute import SimpleImputer
from sklearn.impute import MissingIndicator
from sklearn.preprocessing import OneHotEncoder
from sklearn.pipeline import Pipeline
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
ImportError Traceback (most recent call last)
<ipython-input-25-c801fe55616f> in <module>
1 from sklearn.compose import ColumnTransformer
----> 2 from sklearn.compose import make_column_selector
3 from sklearn.impute import SimpleImputer
4 from sklearn.impute import MissingIndicator
5 from sklearn.preprocessing import OneHotEncoder
ImportError: cannot import name 'make_column_selector' from 'sklearn.compose' (C:\Users\azhad\Anaconda3\lib\site-packages\sklearn\compose\__init__.py)
为了确认,我已经用SciKitLearn 0.23版更新了anaconda。有没有人遇到这个错误?如果您知道发生了什么,请反馈,谢谢!
答案 0 :(得分:0)
在 scikitlearn 0.21 版本上遇到同样的错误。升级到最新版本 (0.24.2) 后,它运行良好。