@@ -115,10 +115,10 @@ define([
115115id :'encoding' ,
116116label :'Encoding' ,
117117axis :FRAME_AXIS . COLUMN ,
118- selection :FRAME_SELECT_TYPE . SINGLE ,
118+ selection :FRAME_SELECT_TYPE . MULTI ,
119119child :[
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([
32373237break ;
32383238case FRAME_EDIT_TYPE . LABEL_ENCODING :
32393239if ( axis == FRAME_AXIS . COLUMN ) {
3240- let encodedColName = this . state . selected . map ( col => {
3240+ let encodedColNameList = this . state . selected . map ( col => {
32413241if ( col . code !== col . label ) {
3242- return com_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- return col . 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}
32483253break ;
32493254case FRAME_EDIT_TYPE . ONE_HOT_ENCODING :