@@ -710,10 +710,7 @@ define([
710
710
return ;
711
711
}
712
712
} else if ( type === FRAME_EDIT_TYPE . REPLACE ) {
713
- if ( content . replacetype === 'condition' && content . value === '' ) {
714
- $ ( this . wrapSelector ( '.vp-inner-popup-input3' ) ) . focus ( ) ;
715
- return ;
716
- }
713
+ ;
717
714
} else if ( type === FRAME_EDIT_TYPE . FILL_NA ) {
718
715
if ( content . method === 'value' && content . value === '' ) {
719
716
$ ( this . wrapSelector ( '.vp-inner-popup-value' ) ) . focus ( ) ;
@@ -3101,7 +3098,7 @@ define([
3101
3098
} ) ;
3102
3099
let valueStr = values . join ( ' ' ) ;
3103
3100
if ( valueStr === "" || valueStr === "''" ) {
3104
- code . appendFormat ( "{0}[{1}] = np.NaN " , tempObj , content . name ) ;
3101
+ code . appendFormat ( "{0}[{1}] = np.nan " , tempObj , content . name ) ;
3105
3102
} else {
3106
3103
code . appendFormat ( "{0}[{1}] = {2}" , tempObj , content . name , valueStr ) ;
3107
3104
}
@@ -3178,6 +3175,9 @@ define([
3178
3175
}
3179
3176
} ) ;
3180
3177
var value = com_util . convertToStr ( content . value , content . valueastext ) ;
3178
+ if ( value === '' ) {
3179
+ value = 'np.nan' ;
3180
+ }
3181
3181
code . appendFormat ( ", {0}] = {1}" , content . name , value ) ;
3182
3182
}
3183
3183
break ;
@@ -3223,9 +3223,10 @@ define([
3223
3223
code . append ( ')' ) ;
3224
3224
} else if ( tab === 'condition' ) {
3225
3225
code . appendFormat ( "{0}.loc[" , tempObj ) ;
3226
+ var condCode = new com_String ( ) ;
3226
3227
content [ 'list' ] . forEach ( ( obj , idx ) => {
3227
3228
let { colName, oper, cond, condAsText, connector } = obj ;
3228
- code . append ( '(' ) ;
3229
+ condCode . append ( '(' ) ;
3229
3230
3230
3231
let colValue = tempObj ;
3231
3232
if ( colName && colName != '' ) {
@@ -3237,25 +3238,31 @@ define([
3237
3238
}
3238
3239
let condValue = com_util . convertToStr ( cond , condAsText ) ;
3239
3240
if ( oper == 'contains' ) {
3240
- code . appendFormat ( '{0}.str.contains({1})' , colValue , condValue ) ;
3241
+ condCode . appendFormat ( '{0}.str.contains({1})' , colValue , condValue ) ;
3241
3242
} else if ( oper == 'not contains' ) {
3242
- code . appendFormat ( '~{0}.str.contains({1})' , colValue , condValue ) ;
3243
+ condCode . appendFormat ( '~{0}.str.contains({1})' , colValue , condValue ) ;
3243
3244
} else if ( oper == 'starts with' ) {
3244
- code . appendFormat ( '{0}.str.startswith({1})' , colValue , condValue ) ;
3245
+ condCode . appendFormat ( '{0}.str.startswith({1})' , colValue , condValue ) ;
3245
3246
} else if ( oper == 'ends with' ) {
3246
- code . appendFormat ( '{0}.str.endswith({1})' , colValue , condValue ) ;
3247
+ condCode . appendFormat ( '{0}.str.endswith({1})' , colValue , condValue ) ;
3247
3248
} else if ( oper == 'isnull()' || oper == 'notnull()' ) {
3248
- code . appendFormat ( '{0}.{1}' , colValue , oper ) ;
3249
+ condCode . appendFormat ( '{0}.{1}' , colValue , oper ) ;
3249
3250
} else {
3250
- code . appendFormat ( '{0}{1}{2}' , colValue , oper != '' ?( ' ' + oper ) :'' , condValue != '' ?( ' ' + condValue ) :'' ) ;
3251
+ condCode . appendFormat ( '{0}{1}{2}' , colValue , oper != '' ?( ' ' + oper ) :'' , condValue != '' ?( ' ' + condValue ) :'' ) ;
3251
3252
}
3252
- code . append ( ')' ) ;
3253
+ condCode . append ( ')' ) ;
3253
3254
if ( idx < ( content [ 'list' ] . length - 1 ) ) {
3254
- code . append ( connector ) ;
3255
+ condCode . append ( connector ) ;
3255
3256
}
3256
3257
} ) ;
3258
+ if ( condCode . toString ( ) === '' ) {
3259
+ condCode . append ( ':' ) ;
3260
+ }
3257
3261
var value = com_util . convertToStr ( content . value , content . valueastext ) ;
3258
- code . appendFormat ( ", {0}] = {1}" , content . name , value ) ;
3262
+ if ( value === '' ) {
3263
+ value = 'np.nan' ;
3264
+ }
3265
+ code . appendFormat ( "{0}, {1}] = {2}" , condCode . toString ( ) , content . name , value ) ;
3259
3266
} else if ( tab == 'apply' ) {
3260
3267
// code.appendFormat("{0}[{1}] = {2}[{3}].apply({4})", tempObj, content.name, tempObj, content.column, content.apply);
3261
3268
let lambdaCode = 'lambda x: ' ;
0 commit comments