@@ -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 {
@@ -2767,7 +2767,7 @@ define([
27672767 var condText = $ ( condTextTag [ i ] ) . prop ( 'checked' ) ;
27682768 var operConn = $ ( operConnTag [ i ] ) . val ( ) ;
27692769 var condObj = { } ;
2770- if ( col !== '' && oper !== '' && cond !== '' ) {
2770+ if ( col !== '' && oper !== '' && ( oper == 'isnull()' || oper === 'notnull()' || cond !== '' ) ) {
27712771 condObj = {
27722772 oper : oper ,
27732773 cond : com_util . convertToStr ( cond , condText )
@@ -2808,7 +2808,7 @@ define([
28082808 var condText = $ ( condTextTag [ i ] ) . prop ( 'checked' ) ;
28092809 var operConn = $ ( operConnTag [ i ] ) . val ( ) ;
28102810 var condObj = { } ;
2811- if ( col !== '' && oper !== '' && cond !== '' ) {
2811+ if ( col !== '' && oper !== '' && ( oper == 'isnull()' || oper === 'notnull()' || cond !== '' ) ) {
28122812 condObj = {
28132813 colName : col ,
28142814 oper : oper ,
@@ -2861,7 +2861,7 @@ define([
28612861 var condText = $ ( condTextTag [ i ] ) . prop ( 'checked' ) ;
28622862 var operConn = $ ( operConnTag [ i ] ) . val ( ) ;
28632863 var condObj = { } ;
2864- if ( col !== '' && oper !== '' && cond !== '' ) {
2864+ if ( col !== '' && oper !== '' && ( oper == 'isnull()' || oper === 'notnull()' || cond !== '' ) ) {
28652865 condObj = {
28662866 colName : col ,
28672867 oper : oper ,
@@ -2894,7 +2894,7 @@ define([
28942894 var condText = $ ( condTextTag [ i ] ) . prop ( 'checked' ) ;
28952895 var operConn = $ ( operConnTag [ i ] ) . val ( ) ;
28962896 var condObj = { } ;
2897- if ( col !== '' && oper !== '' && cond !== '' ) {
2897+ if ( col !== '' && oper !== '' && ( oper == 'isnull()' || oper === 'notnull()' || cond !== '' ) ) {
28982898 condObj = {
28992899 oper : oper ,
29002900 cond : com_util . convertToStr ( cond , condText )
@@ -3237,13 +3237,18 @@ define([
32373237 break ;
32383238 case FRAME_EDIT_TYPE . LABEL_ENCODING :
32393239 if ( axis == FRAME_AXIS . COLUMN ) {
3240- let encodedColName = this . state . selected . map ( col => {
3240+ let encodedColNameList = this . state . selected . map ( col => {
32413241 if ( 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 }
32483253 break ;
32493254 case FRAME_EDIT_TYPE . ONE_HOT_ENCODING :
0 commit comments