尽管我已经通过 Jupyter 成功安装了 sklearn,但我无法访问它的类。我犯了什么错误?

问题描述 投票:0回答:1

尽管我已经通过 Jupyter 成功安装了 sklearn,但我无法访问它的类。我犯了什么错误?

!pip install sklearn
import sklean
from sklearn.preprocessing import LabelEncoder
ImportError                               Traceback (most recent call last)
Input In [7], in <cell line: 2>()
      1 import pandas as pd
----> 2 from sklearn.preprocessing import LabelEncoder
      3 label_encoder = LabelEncoder()
      4 # Aplique o LabelEncoder à coluna categórica

ImportError: cannot import name 'LabelEncoder' from 'sklearn.preprocessing' (unknown location).
python class import deprecated sklearn-pandas
1个回答
0
投票

您遇到的错误是由于代码中的拼写错误造成的。
您编写了“import sklean”而不是“import sklearn”,这就是您无法从

sklearn.preprocessing
模块访问类的原因。

© www.soinside.com 2019 - 2024. All rights reserved.