I am new to nodejs and looking to loop through each row and subtract previous row cell using dataframe-js library.
const columns = ["x","y","gap"];
const df= new DataFrame(dict,columns);
df.sortBy(['y'], true);
df.map(row => row.set('gap', row.get('y') - row.get('y')-1));
You didn't really ask question, if you want to know how to access the previous element within Array.map() it's quite easy Array.map() passes the index of the current element as 2nd paramater and the array as 3rd so you could do something
on another note unless you are returning something you should use
df.forEach()instead ofdf.map()