数据挖掘比赛通用框架

toy_data前几个样本的Continent字段举例,对其进行编码:

mapper = skp.DataFrameMapper([

('Continent', sklearn.preprocessing.LabelBinarizer()),

])

tempX = df[['Continent']].head()

print tempX

print mapper.fit_transform(tempX.copy())

运行结果如下