【问题标题】:Error when trying to use labelEncoder() in sklearn "Attribute error: module object has no attribute labelEncoder"尝试在 sklearn 中使用 labelEncoder() 时出错“属性错误:模块对象没有属性 labelEncoder”
【发布时间】:2017-08-13 13:46:40
【问题描述】:

我是 python 和 sklearn 的新手。我使用

安装了sklearn
pip install scikit-learn

这安装了 scikit-learn 的 0.18.1 版本。我验证了 python 使用的是相同的版本(sklearn.version) 但是我收到以下错误 “AttributeError:‘模块’对象没有属性‘labelEncoder’” 当我尝试执行以下操作时:

from sklearn import preprocessing
le = preprocessing.labelEncoder()

(如果相关,我正在使用 Python 2.7)

【问题讨论】:

    标签: python-2.7 scikit-learn attributeerror


    【解决方案1】:

    试试这个

    from sklearn import preprocessing
    le = preprocessing.LabelEncoder()
    

    【讨论】:

      猜你喜欢
      • 2019-07-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-29
      • 2011-10-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多