Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1403bab

Browse files
author
minjk-bl
committed
Edit to enable encodings on multiselected columns
1 parent49c86ac commit1403bab

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

‎visualpython/js/m_apps/Frame.js‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ define([
115115
id:'encoding',
116116
label:'Encoding',
117117
axis:FRAME_AXIS.COLUMN,
118-
selection:FRAME_SELECT_TYPE.SINGLE,
118+
selection:FRAME_SELECT_TYPE.MULTI,
119119
child:[
120-
{id:'label_encoding',label:'Label encoding',axis:FRAME_AXIS.COLUMN,selection:FRAME_SELECT_TYPE.SINGLE,menuType:FRAME_EDIT_TYPE.LABEL_ENCODING},
121-
{id:'one_hot_encoding',label:'Onehot encoding',axis:FRAME_AXIS.COLUMN,selection:FRAME_SELECT_TYPE.SINGLE,menuType:FRAME_EDIT_TYPE.ONE_HOT_ENCODING},
120+
{id:'label_encoding',label:'Label encoding',axis:FRAME_AXIS.COLUMN,selection:FRAME_SELECT_TYPE.MULTI,menuType:FRAME_EDIT_TYPE.LABEL_ENCODING},
121+
{id:'one_hot_encoding',label:'Onehot encoding',axis:FRAME_AXIS.COLUMN,selection:FRAME_SELECT_TYPE.MULTI,menuType:FRAME_EDIT_TYPE.ONE_HOT_ENCODING},
122122
]
123123
},
124124
{
@@ -3237,13 +3237,18 @@ define([
32373237
break;
32383238
caseFRAME_EDIT_TYPE.LABEL_ENCODING:
32393239
if(axis==FRAME_AXIS.COLUMN){
3240-
letencodedColName=this.state.selected.map(col=>{
3240+
letencodedColNameList=this.state.selected.map(col=>{
32413241
if(col.code!==col.label){
3242-
returncom_util.formatString("'{0}'",col.label+'_label');
3242+
return{'origin':com_util.formatString("'{0}'",col.label),'encoded':com_util.formatString("'{0}'",col.label+'_label')};
32433243
}
3244-
returncol.label+'_label'
3245-
}).join(',');
3246-
code.appendFormat("{0}[{1}] = pd.Categorical({2}[{3}]).codes",tempObj,encodedColName,tempObj,selectedName);
3244+
return{'origin':col.label,'encoded':col.label+'_label'};
3245+
});
3246+
encodedColNameList.forEach((encodedColObj,idx)=>{
3247+
if(idx>0){
3248+
code.appendLine();
3249+
}
3250+
code.appendFormat("{0}[{1}] = pd.Categorical({2}[{3}]).codes",tempObj,encodedColObj['encoded'],tempObj,encodedColObj['origin']);
3251+
});
32473252
}
32483253
break;
32493254
caseFRAME_EDIT_TYPE.ONE_HOT_ENCODING:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp