Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 标签编码Sci工具包库时出错_Python_Scikit Learn - Fatal编程技术网

Python 标签编码Sci工具包库时出错

Python 标签编码Sci工具包库时出错,python,scikit-learn,Python,Scikit Learn,我正在尝试对格式为字符串的数据帧进行编码,但收到以下错误: 错误: 下面是sklearn文档中的一个示例,希望对您有所帮助 然而,在您的例子中,您使用的是df,它可能是具有多列的数据帧,或者可能有空值 from sklearn import preprocessing df = [1, 1, 2, 6] le = preprocessing.LabelEncoder().fit_transform(df) print(le) from sklearn

我正在尝试对格式为字符串的数据帧进行编码,但收到以下错误:

错误:


下面是sklearn文档中的一个示例,希望对您有所帮助 然而,在您的例子中,您使用的是df,它可能是具有多列的数据帧,或者可能有空值

    from sklearn import preprocessing
    df = [1, 1, 2, 6]
    le = preprocessing.LabelEncoder().fit_transform(df) 
    print(le)
    from sklearn import preprocessing
    df = [1, 1, 2, 6]
    le = preprocessing.LabelEncoder().fit_transform(df) 
    print(le)