@@ -630,12 +630,7 @@ define([
630630 // calc - variable 1
631631 content . appendLine ( '<tr>' ) ;
632632 content . appendLine ( '<th><label>Variable 1</label></th>' ) ;
633- var dataTypes = [ 'DataFrame' , 'Series' , 'nparray' , 'list' , 'str' ] ;
634- var varSelector1 = new VarSelector ( dataTypes , 'DataFrame' , true , true ) ;
635- varSelector1 . addBoxClass ( 'vp-inner-popup-var1box mb5' ) ;
636- varSelector1 . addClass ( 'vp-inner-popup-var1' ) ;
637- content . appendFormatLine ( '<td>{0}' , varSelector1 . render ( ) ) ;
638- content . appendFormatLine ( '<select class="{0}"></select></td>' , 'vp-inner-popup-var1col' ) ;
633+ content . appendFormatLine ( '<td><select class="{0}"></select></td>' , 'vp-inner-popup-var1col' ) ;
639634 content . appendLine ( '</tr>' ) ;
640635 // calc -operator
641636 content . appendLine ( '<tr>' ) ;
@@ -650,11 +645,7 @@ define([
650645 // calc - variable 2
651646 content . appendLine ( '<tr>' ) ;
652647 content . appendLine ( '<th><label>Variable 2</label></th>' ) ;
653- var varSelector2 = new VarSelector ( dataTypes , 'DataFrame' , true , true ) ;
654- varSelector2 . addBoxClass ( 'vp-inner-popup-var2box mb5' ) ;
655- varSelector2 . addClass ( 'vp-inner-popup-var2' ) ;
656- content . appendFormatLine ( '<td>{0}' , varSelector2 . render ( ) ) ;
657- content . appendFormatLine ( '<select class="{0}"></select></td>' , 'vp-inner-popup-var2col' ) ;
648+ content . appendFormatLine ( '<td><select class="{0}"></select></td>' , 'vp-inner-popup-var2col' ) ;
658649 content . appendLine ( '</tr>' ) ;
659650 content . appendLine ( '</table>' ) ;
660651 content . appendLine ( '</div>' ) ; // end of vp-inner-popup-tab calculation
@@ -802,6 +793,33 @@ define([
802793
803794 // bindEventForAddPage
804795 this . bindEventForPopupPage ( ) ;
796+
797+ let that = this ;
798+
799+ // set column list
800+ vpKernel . getColumnList ( this . state . tempObj ) . then ( function ( resultObj ) {
801+ let { result } = resultObj ;
802+ var colList = JSON . parse ( result ) ;
803+ var tag1 = new com_String ( ) ;
804+ var tag2 = new com_String ( ) ;
805+ tag1 . appendFormatLine ( '<select class="{0}">' , 'vp-inner-popup-var1col' ) ;
806+ tag2 . appendFormatLine ( '<select class="{0}">' , 'vp-inner-popup-var2col' ) ;
807+ colList && colList . forEach ( col => {
808+ tag1 . appendFormatLine ( '<option data-code="{0}" value="{1}">{2}</option>'
809+ , col . value , col . label , col . label ) ;
810+ tag2 . appendFormatLine ( '<option data-code="{0}" value="{1}">{2}</option>'
811+ , col . value , col . label , col . label ) ;
812+ } ) ;
813+ tag1 . appendLine ( '</select>' ) ;
814+ tag2 . appendLine ( '</select>' ) ;
815+ // replace column list
816+ $ ( that . wrapSelector ( '.vp-inner-popup-var1col' ) ) . replaceWith ( function ( ) {
817+ return tag1 . toString ( ) ;
818+ } ) ;
819+ $ ( that . wrapSelector ( '.vp-inner-popup-var2col' ) ) . replaceWith ( function ( ) {
820+ return tag2 . toString ( ) ;
821+ } ) ;
822+ } ) ;
805823
806824 // show popup box
807825 this . openInnerPopup ( title ) ;
@@ -824,12 +842,8 @@ define([
824842 content [ 'value' ] = $ ( this . wrapSelector ( '.vp-inner-popup-input2' ) ) . val ( ) ;
825843 content [ 'valueastext' ] = $ ( this . wrapSelector ( '.vp-inner-popup-istext2' ) ) . prop ( 'checked' ) ;
826844 } else if ( tab == 'calculation' ) {
827- content [ 'var1type' ] = $ ( this . wrapSelector ( '.vp-inner-popup-var1box .vp-vs-data-type' ) ) . val ( ) ;
828- content [ 'var1' ] = $ ( this . wrapSelector ( '.vp-inner-popup-var1' ) ) . val ( ) ;
829845 content [ 'var1col' ] = $ ( this . wrapSelector ( '.vp-inner-popup-var1col' ) ) . val ( ) ;
830846 content [ 'oper' ] = $ ( this . wrapSelector ( '.vp-inner-popup-oper' ) ) . val ( ) ;
831- content [ 'var2type' ] = $ ( this . wrapSelector ( '.vp-inner-popup-var2box .vp-vs-data-type' ) ) . val ( ) ;
832- content [ 'var2' ] = $ ( this . wrapSelector ( '.vp-inner-popup-var2' ) ) . val ( ) ;
833847 content [ 'var2col' ] = $ ( this . wrapSelector ( '.vp-inner-popup-var2col' ) ) . val ( ) ;
834848 } else if ( tab == 'replace' ) {
835849 var useregex = $ ( this . wrapSelector ( '.vp-inner-popup-use-regex' ) ) . prop ( 'checked' ) ;
@@ -1052,6 +1066,11 @@ define([
10521066 code . appendFormat ( "{0}.drop_duplicates(subset=[{1}], inplace=True)" , tempObj , selectedName ) ;
10531067 }
10541068 break ;
1069+ case FRAME_EDIT_TYPE . DROP_OUT :
1070+ if ( axis == FRAME_AXIS . COLUMN ) {
1071+ code . appendFormat ( "{0} = vp_drop_outlier({1}, {2})" , tempObj , tempObj , selectedName ) ;
1072+ }
1073+ break ;
10551074 case FRAME_EDIT_TYPE . ONE_HOT_ENCODING :
10561075 if ( axis == FRAME_AXIS . COLUMN ) {
10571076 code . appendFormat ( "{0} = pd.get_dummies(data={1}, columns=[{2}])" , tempObj , tempObj , selectedName ) ;
@@ -1082,15 +1101,9 @@ define([
10821101 var value = com_util . convertToStr ( content . value , content . valueastext ) ;
10831102 code . appendFormat ( "{0}[{1}] = {2}" , tempObj , name , value ) ;
10841103 } else if ( tab == 'calculation' ) {
1085- var { var1type, var1, var1col, oper, var2type, var2, var2col } = content ;
1086- var var1code = var1 ;
1087- if ( var1type == 'DataFrame' ) {
1088- var1code += "['" + var1col + "']" ;
1089- }
1090- var var2code = var2 ;
1091- if ( var2type == 'DataFrame' ) {
1092- var2code += "['" + var2col + "']" ;
1093- }
1104+ var { var1col, oper, var2col } = content ;
1105+ var var1code = tempObj + "['" + var1col + "']" ;
1106+ var var2code = tempObj + "['" + var2col + "']" ;
10941107 code . appendFormat ( '{0}[{1}] = {2} {3} {4}' , tempObj , name , var1code , oper , var2code ) ;
10951108 } else if ( tab == 'replace' ) {
10961109 var replaceStr = new com_String ( ) ;
@@ -1368,6 +1381,8 @@ define([
13681381 DROP : 3 ,
13691382 DROP_NA : 4 ,
13701383 DROP_DUP : 5 ,
1384+ DROP_OUT : 11 ,
1385+
13711386 ONE_HOT_ENCODING : 6 ,
13721387 SET_IDX : 7 ,
13731388 RESET_IDX : 8 ,
0 commit comments