Skip to content

Commit a25b0e6

Browse files
author
minjk-bl
committed
Edit concat's reset_index operation to ignore_index option
1 parent c476121 commit a25b0e6

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed

js/m_apps/Bind.js

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ define([
117117
if (type == 'concat') {
118118
$(that.wrapSelector('.vp-bd-type-box.concat')).show();
119119
$(that.wrapSelector('.vp-bd-type-box.merge')).hide();
120+
$(that.wrapSelector('#vp_bdWithoutColumn')).hide();
120121
} else {
121122
$(that.wrapSelector('.vp-bd-type-box.merge')).show();
122123
$(that.wrapSelector('.vp-bd-type-box.concat')).hide();
124+
$(that.wrapSelector('#vp_bdWithoutColumn')).show();
123125
}
124126
// clear user option
125127
$(that.wrapSelector('#vp_bdUserOption')).val('');
@@ -380,6 +382,13 @@ define([
380382
render() {
381383
super.render();
382384

385+
// check its type
386+
if (this.state.type === 'concat') {
387+
$(this.wrapSelector('#vp_bdWithoutColumn')).hide();
388+
} else {
389+
$(this.wrapSelector('#vp_bdWithoutColumn')).hide();
390+
}
391+
383392
this.loadVariableList();
384393
}
385394

@@ -389,20 +398,6 @@ define([
389398
* @param {string} defaultValue previous value
390399
*/
391400
renderVariableList(id, varList, defaultValue='') {
392-
// var tag = new com_String();
393-
// tag.appendFormatLine('<select id="{0}">', id);
394-
// varList.forEach(vObj => {
395-
// // varName, varType
396-
// var label = vObj.varName;
397-
// tag.appendFormatLine('<option value="{0}" data-type="{1}" {2}>{3}</option>'
398-
// , vObj.varName, vObj.varType
399-
// , defaultValue == vObj.varName?'selected':''
400-
// , label);
401-
// });
402-
// tag.appendLine('</select>'); // VP_VS_VARIABLES
403-
// $(this.wrapSelector('#' + id)).replaceWith(function() {
404-
// return tag.toString();
405-
// });
406401
let mappedList = varList.map(obj => { return { label: obj.varName, value: obj.varName, dtype: obj.varType } });
407402

408403
var variableInput = new SuggestInput();
@@ -420,7 +415,7 @@ define([
420415
/**
421416
* Load variable list (dataframe)
422417
*/
423-
loadVariableList() {
418+
loadVariableList() {
424419
var that = this;
425420
// load using kernel
426421
var dataTypes = ['DataFrame'];
@@ -476,6 +471,13 @@ define([
476471
code.append(', sort=True');
477472
}
478473

474+
//====================================================================
475+
// Reset index
476+
//====================================================================
477+
if (resetIndex) {
478+
code.append(', ignore_index=True');
479+
}
480+
479481
//====================================================================
480482
// User option
481483
//====================================================================
@@ -538,16 +540,16 @@ define([
538540
}
539541

540542
code.append(')');
541-
}
542543

543-
//====================================================================
544-
// Reset index
545-
//====================================================================
546-
if (resetIndex) {
547-
if (withoutColumn === 'True') {
548-
code.append('.reset_index(drop=True)');
549-
} else {
550-
code.append('.reset_index()');
544+
//====================================================================
545+
// Reset index
546+
//====================================================================
547+
if (resetIndex) {
548+
if (withoutColumn === 'True') {
549+
code.append('.reset_index(drop=True)');
550+
} else {
551+
code.append('.reset_index()');
552+
}
551553
}
552554
}
553555

0 commit comments

Comments
 (0)