把每个类别生成一个布尔列,这些列中只有一列可以为这个样本取值为1.其又被称为独热编码。 把下图中左边的表格转化为使用右边形式进行表示:
要把类别变成可用于数值计算的值
加入非线性
距离信息得到很好的转换--距离相等
pandas.get_dummies(data, prefix=None)