@@ -630,12 +630,7 @@ define([
630
630
// calc - variable 1
631
631
content . appendLine ( '<tr>' ) ;
632
632
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' ) ;
639
634
content . appendLine ( '</tr>' ) ;
640
635
// calc -operator
641
636
content . appendLine ( '<tr>' ) ;
@@ -650,11 +645,7 @@ define([
650
645
// calc - variable 2
651
646
content . appendLine ( '<tr>' ) ;
652
647
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' ) ;
658
649
content . appendLine ( '</tr>' ) ;
659
650
content . appendLine ( '</table>' ) ;
660
651
content . appendLine ( '</div>' ) ; // end of vp-inner-popup-tab calculation
@@ -802,6 +793,33 @@ define([
802
793
803
794
// bindEventForAddPage
804
795
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
+ } ) ;
805
823
806
824
// show popup box
807
825
this . openInnerPopup ( title ) ;
@@ -824,12 +842,8 @@ define([
824
842
content [ 'value' ] = $ ( this . wrapSelector ( '.vp-inner-popup-input2' ) ) . val ( ) ;
825
843
content [ 'valueastext' ] = $ ( this . wrapSelector ( '.vp-inner-popup-istext2' ) ) . prop ( 'checked' ) ;
826
844
} 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 ( ) ;
829
845
content [ 'var1col' ] = $ ( this . wrapSelector ( '.vp-inner-popup-var1col' ) ) . val ( ) ;
830
846
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 ( ) ;
833
847
content [ 'var2col' ] = $ ( this . wrapSelector ( '.vp-inner-popup-var2col' ) ) . val ( ) ;
834
848
} else if ( tab == 'replace' ) {
835
849
var useregex = $ ( this . wrapSelector ( '.vp-inner-popup-use-regex' ) ) . prop ( 'checked' ) ;
@@ -1052,6 +1066,11 @@ define([
1052
1066
code . appendFormat ( "{0}.drop_duplicates(subset=[{1}], inplace=True)" , tempObj , selectedName ) ;
1053
1067
}
1054
1068
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 ;
1055
1074
case FRAME_EDIT_TYPE . ONE_HOT_ENCODING :
1056
1075
if ( axis == FRAME_AXIS . COLUMN ) {
1057
1076
code . appendFormat ( "{0} = pd.get_dummies(data={1}, columns=[{2}])" , tempObj , tempObj , selectedName ) ;
@@ -1082,15 +1101,9 @@ define([
1082
1101
var value = com_util . convertToStr ( content . value , content . valueastext ) ;
1083
1102
code . appendFormat ( "{0}[{1}] = {2}" , tempObj , name , value ) ;
1084
1103
} 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 + "']" ;
1094
1107
code . appendFormat ( '{0}[{1}] = {2} {3} {4}' , tempObj , name , var1code , oper , var2code ) ;
1095
1108
} else if ( tab == 'replace' ) {
1096
1109
var replaceStr = new com_String ( ) ;
@@ -1368,6 +1381,8 @@ define([
1368
1381
DROP : 3 ,
1369
1382
DROP_NA : 4 ,
1370
1383
DROP_DUP : 5 ,
1384
+ DROP_OUT : 11 ,
1385
+
1371
1386
ONE_HOT_ENCODING : 6 ,
1372
1387
SET_IDX : 7 ,
1373
1388
RESET_IDX : 8 ,
0 commit comments