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)