Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. # Encoder <code py> from sklearn.preprocessing import OneHotEncoder, LabelEncoder oe = OneHotEncoder() oe_result = oe.fit_transform(train['workclass'].values.reshape(-1,1)).toarray() oe.get_feature_names(['workclass']) pd.DataFrame(data=oe_result, columns=oe.get_feature_names(['workclass'])) le = LabelEncoder() le.fit_transform(train['workclsss'].values.reshape(-1,1)) workclass_to_num = dict(zip(train['workclass'].unique(), range(0,10))) train['workclass'].map(workclass_to_num) </code> ### onehot 인코딩 일괄적으로 <code> dummied = pd.get_dummies(train) </code> open/encoder.txt Last modified: 2024/10/05 06:15by 127.0.0.1