After parsing CSV:
id,x
1,0.358995018
2,0.196424349
3,0.882696509
4,0.765233761
5,0.25087529
with code
let lines = data.split('\n');
let props = lines.shift().split(',');
let objects = [];
for (let line of lines) {
let values = line.split(',');
let obj = {};
for (let i = 0; i < props.length; i++)
obj[props[i]] = isNaN(values[i]) ? values[i] : parseFloat(values[i]);
objects.push(obj);
}
this.data = objects;
can't access last property of any object and for some reason it's double quoted in debugger... What's going on?
via Eugene
No comments:
Post a Comment