DataFrame通过sklearn做数据预处理

来源:互联网 发布:linux df产生文件 编辑:程序博客网 时间:2024/06/09 23:17

以下不会出现warning:

import numpy as npimport pandas as pdfrom sklearn.preprocessing import MinMaxScalerfrom sklearn.preprocessing import Binarizert = pd.DataFrame({    'A': [1, 1, 2, 2, 3],    'B': [4, 5, 5, 6, 6]})t.A =  MinMaxScaler().fit_transform(t.A.astype('float').values.reshape((-1, 1)))t.A = Binarizer(2).fit_transform(t.A.astype('float').values.reshape((-1, 1)))