当前位置:网站首页>成功解决:ImportError: cannot import name ‘Imputer‘ from ‘sklearn.preprocessing
成功解决:ImportError: cannot import name ‘Imputer‘ from ‘sklearn.preprocessing
2022-06-10 06:39:00 【小袁ITSuper】
成功解决:ImportError: cannot import name ‘Imputer‘ from ‘sklearn.preprocessing
前言
本文已收录于:《告别Bug》专栏
本专栏用于记录学习和工作中遇到的各种疑难Bug问题及解决思路+解决方法,包括程序安装、运行程序过程中的问题等等,订阅专栏后如遇到其他问题可私聊帮忙解决!!!
报错问题
我的代码:
from sklearn.preprocessing import Imputer
报错信息:
ImportError: cannot import name 'Imputer' from 'sklearn.preprocessing' (D:\Python3.8\lib\site-packages\sklearn\preprocessing\__init__.py)

报错原因
报错翻译:
ImportError:无法从“sklearn”导入名称“inputer”。预处理'(D:\Python3.8\lib\site packages\sklearn\preprocessing\uu init\uuuuuuu.py)
报错原因:0.20新版功能:SimpleImputer取代了以前的sklearn.preprocessing.Imputer
解决方法
1、将导库语句换成如下语句
from sklearn.impute import SimpleImputer
2、将程序中原来使用的Imputer改为SimpleImputer即可

3、再次运行成功
[[ 1.28620952e-15 3.82970843e+00]
[ 5.74456265e+00 -1.91485422e+00]
[-5.74456265e+00 -1.91485422e+00]]
边栏推荐
- Jerry's aicmd_ SET_ BT_ Addr command format [chapter]
- Virtual machine network connection mode
- 判斷進程是否有管理員權限
- Tensorflow experiment IX ---------- Titanic
- 2022-2027 (New Edition) forecast report on application status and development potential of China's superhard material industry
- 虚拟机网络连接方式
- SM2 state secret encryption and signing operation tool
- White plus black over 360 startup item tool source code release multiple files over startup item code
- MPC - model predictive control
- Longest common subsequence
猜你喜欢

Nextcloud internal server error the server cannot complete your request workaround

Leetcode675. Cutting trees for golf competition: priority queue + breadth first to find the shortest path

Saccadenet: use corner features to fine tune the two stage prediction frame | CVPR 2020

TeleyeControlor V8.47版本发布 更改Socket框架

Business topic: channel flow analysis

The third part of urban informatics - Intelligent geography can realize personalized and sustainable urban transportation in the future

Using fieldmask to improve c grpc service performance yyds dry inventory

Teacher lihongyi's notes on machine learning -5 transformer

Opengauss database ODBC environment connection configuration (Windows)

Teleyecontroller v8.7 repair Wan cable and add display delay function
随机推荐
Embedded development | common operations of EEPROM driver code
Saccadenet: use corner features to fine tune the two stage prediction frame | CVPR 2020
Online chat -- Introduction and implementation of websocket
tensorflow实验十-----图片翻转与缩放
白加黑过360启动项工具源码发布 多文件过启动项代码
TeleyeControlor V8.16发布 完成注册表功能
Longest common subsequence
Go zero micro Service Practice Series (II. Service splitting)
SQL practice part: SQL row column conversion and real problems
电脑新加内存条后 游戏崩溃 浏览器卡死 电脑蓝屏
Long press the page at the mobile terminal, do not copy text and single picture
Packing and unpacking in C #
Daily practice: Longest symmetric string (pay attention to the last two methods)
Business topic: user usage path analysis
Scala fastjson modifying key or value
PM2 installation and common commands
BOM browser object model
Jerry's aicmd_ SET_ BT_ Addr command format [chapter]
Stm32f1 and stm32subeide quick start - overview of interrupts, NVIC and exti
Leetcode game 79 biweekly - complete all questions