2019独角兽企业重金招聘Python工程师标准>>>
def preprocess2():"""数据预处理:return:"""data = pd.read_csv('./dataset/preprocess_1',delimiter=',', header=None, names=['licheng', 'youxi', 'bingbang', 'xihuang'])print(data.describe())tmpa = data['xihuang']# 统计种类a = tmpa.value_counts(dropna=False)xihuangmaping = {"didntLike": 1, "smallDoses ": 2, "largeDoses": 3, 'smallDoses': 0}data['xihuang'] = data['xihuang'].map(xihuangmaping)data['xihuang'] = data['xihuang'].astype(np.int16)data['xihuang'] = data['xihuang'].astype(np.int16)data.to_csv('./dataset/preprocess_2', index=None)