[datameet] Re: merging arrays in d3.js

2016-05-26 Thread Pratap Vardhan
You could use push() method with forEach() var dataset = [] d3.csv('elex.csv', function(data) { data.forEach(function(d) { dataset.push( [+d["CONUM"], +d["PIXPMK"]], [+d["CONUM"], +d["PIXMAR"]] ) }) }) JSON.stringify(dataset)

[datameet] merging arrays in d3.js

2016-05-26 Thread Kuhu Gupta
My elex.csv is in this format- "CONUM",PIXPMK","PIXMAR "1","461","436" "2","398","428", "3","447","436" I want my dataset in this format- var dataset1 = [ [1, 417], [1, 436], [2, 398], [2, 428], [3, 447], [3, 436]]; I have tried several times to get the fetch the data from csv in this form