Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions visualpython/js/com/com_Kernel.js
Original file line number Diff line number Diff line change
Expand Up @@ -610,10 +610,14 @@ define([
* @param {*} dataframe
* @returns
*/
getRowList(dataframe) {
getRowList(dataframe, start_idx) {
var that = this;
if (typeof start_idx === 'undefined') {
start_idx = 0;
}

return new Promise(function(resolve, reject) {
that.execute(com_util.formatString('_vp_print(_vp_get_rows_list({0}))', dataframe))
that.execute(com_util.formatString('_vp_print(_vp_get_rows_list({0}, {1}))', dataframe, start_idx))
.then(function(resultObj) {
resolve(resultObj);
}).catch(function(err) {
Expand Down
11 changes: 7 additions & 4 deletions visualpython/js/m_apps/Subset.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,13 @@ define([
$(this.wrapSelector('.select-row .vp-ds-select-box.left')).on('scroll', function() {
if ($(this).scrollTop() + $(this).innerHeight() >= ($(this)[0].scrollHeight - 2)) {
let scrollPos = $(this).scrollTop();
if (that.state.rowLimit > that.state.rowList.length){
return; // Prevents scroll from being fixed downwards
}
let start = that.state.rowLimit;
let end = start + 10;
let subsetVariable = com_util.formatString('{0}.iloc[{1}:{2}]', that.state.pandasObject, start, end);
vpKernel.getRowList(subsetVariable).then(function (resultObj) {
vpKernel.getRowList(subsetVariable, start).then(function (resultObj) {
let { result } = resultObj;
var { list:rowList } = JSON.parse(result);
rowList = rowList.map(function (x) {
Expand All @@ -361,9 +364,9 @@ define([
rowList = rowList.map(function (x) {
return {
...x,
label: x.location + '',
value: x.location + '',
code: x.location + '',
label: x.label + '',
value: x.value + '',
code: x.code + '',
};
});
}
Expand Down
5 changes: 3 additions & 2 deletions visualpython/python/pandasCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
# from IPython.core.display is deprecated since IPython 7.14
from IPython.display import display

def _vp_get_rows_list(df):
def _vp_get_rows_list(df, start_idx=0):
"""
Get Rows List with Detail Information
"""
rowInfo = { 'name': df.index.name, 'level': df.index.nlevels, 'list': [] }
indexType = str(df.index.dtype)
# make dict for rows info
for i, r in enumerate(df.index):
rInfo = { 'label': r, 'value': r, 'location': i }
rInfo = { 'label': r, 'value': r, 'location': start_idx + i }

# value
if type(r).__name__ == 'str':
rInfo['value'] = "'{}'".format(r)
Expand Down