数据预处理常用代码

1.离散变量标签处理

原始数据

import pandas as pd
df = pd.DataFrame([
            ['green', 'M', 10.1, 'class1'], 
            ['red', 'L', 13.5, 'class2'], 
            ['blue', 'XL', 15.3, 'class1']])

df.columns = ['color', 'size', 'prize', 'class label']

1.1 原始处理方法

猜你喜欢

转载自www.cnblogs.com/itbuyixiaogong/p/9847997.html