Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd79f48c

Browse files
author
minjk-bl
committed
Edit not to add condition if its target and operator is not selected
1 parent722b2db commitd79f48c

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

‎visualpython/js/m_apps/Frame.js‎

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -710,10 +710,7 @@ define([
710710
return;
711711
}
712712
}elseif(type===FRAME_EDIT_TYPE.REPLACE){
713-
if(content.replacetype==='condition'&&content.value===''){
714-
$(this.wrapSelector('.vp-inner-popup-input3')).focus();
715-
return;
716-
}
713+
;
717714
}elseif(type===FRAME_EDIT_TYPE.FILL_NA){
718715
if(content.method==='value'&&content.value===''){
719716
$(this.wrapSelector('.vp-inner-popup-value')).focus();
@@ -3101,7 +3098,7 @@ define([
31013098
});
31023099
letvalueStr=values.join(' ');
31033100
if(valueStr===""||valueStr==="''"){
3104-
code.appendFormat("{0}[{1}] = np.NaN",tempObj,content.name);
3101+
code.appendFormat("{0}[{1}] = np.nan",tempObj,content.name);
31053102
}else{
31063103
code.appendFormat("{0}[{1}] = {2}",tempObj,content.name,valueStr);
31073104
}
@@ -3178,6 +3175,9 @@ define([
31783175
}
31793176
});
31803177
varvalue=com_util.convertToStr(content.value,content.valueastext);
3178+
if(value===''){
3179+
value='np.nan';
3180+
}
31813181
code.appendFormat(", {0}] = {1}",content.name,value);
31823182
}
31833183
break;
@@ -3223,9 +3223,10 @@ define([
32233223
code.append(')');
32243224
}elseif(tab==='condition'){
32253225
code.appendFormat("{0}.loc[",tempObj);
3226+
varcondCode=newcom_String();
32263227
content['list'].forEach((obj,idx)=>{
32273228
let{ colName, oper, cond, condAsText, connector}=obj;
3228-
code.append('(');
3229+
condCode.append('(');
32293230

32303231
letcolValue=tempObj;
32313232
if(colName&&colName!=''){
@@ -3237,25 +3238,31 @@ define([
32373238
}
32383239
letcondValue=com_util.convertToStr(cond,condAsText);
32393240
if(oper=='contains'){
3240-
code.appendFormat('{0}.str.contains({1})',colValue,condValue);
3241+
condCode.appendFormat('{0}.str.contains({1})',colValue,condValue);
32413242
}elseif(oper=='not contains'){
3242-
code.appendFormat('~{0}.str.contains({1})',colValue,condValue);
3243+
condCode.appendFormat('~{0}.str.contains({1})',colValue,condValue);
32433244
}elseif(oper=='starts with'){
3244-
code.appendFormat('{0}.str.startswith({1})',colValue,condValue);
3245+
condCode.appendFormat('{0}.str.startswith({1})',colValue,condValue);
32453246
}elseif(oper=='ends with'){
3246-
code.appendFormat('{0}.str.endswith({1})',colValue,condValue);
3247+
condCode.appendFormat('{0}.str.endswith({1})',colValue,condValue);
32473248
}elseif(oper=='isnull()'||oper=='notnull()'){
3248-
code.appendFormat('{0}.{1}',colValue,oper);
3249+
condCode.appendFormat('{0}.{1}',colValue,oper);
32493250
}else{
3250-
code.appendFormat('{0}{1}{2}',colValue,oper!=''?(' '+oper):'',condValue!=''?(' '+condValue):'');
3251+
condCode.appendFormat('{0}{1}{2}',colValue,oper!=''?(' '+oper):'',condValue!=''?(' '+condValue):'');
32513252
}
3252-
code.append(')');
3253+
condCode.append(')');
32533254
if(idx<(content['list'].length-1)){
3254-
code.append(connector);
3255+
condCode.append(connector);
32553256
}
32563257
});
3258+
if(condCode.toString()===''){
3259+
condCode.append(':');
3260+
}
32573261
varvalue=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);
32593266
}elseif(tab=='apply'){
32603267
// code.appendFormat("{0}[{1}] = {2}[{3}].apply({4})", tempObj, content.name, tempObj, content.column, content.apply);
32613268
letlambdaCode='lambda x: ';

‎visualpython/js/m_apps/Subset.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1742,7 +1742,7 @@ define([
17421742
varconnector=i>0 ?$(condList[i-1]).find('.vp-oper-connect').val() :undefined;
17431743

17441744
// if no variable selected, pass
1745-
if(varName=="")
1745+
if(varName===""||oper==="")
17461746
continue;
17471747
if(useCondition){
17481748
rowSelection.append(connector);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp