I just downloaded d3 because I want to read a csv file that contains only one column filled with 20 random numbers. It looks like this:
number
23
1
5
10
13
The code I have so far is below (which I mimicked from this stackoverflow page:
var d3 = require("d3");
var field = [];
d3.csv("numbers.csv",function(csv){
csv.map(function(d){
field.push(+d.number);
})
console.log("field",field);
});
I wasn't sure how to run it, so I downloaded Node.js and in the Node.js command prompt, when I type in 'node number.js' (which I named my file), I get
field [ NaN, NaN, NaN ]
If I take out the '+' in front of "d.number," I get a bunch of 'undefined' in place of the 'NaN'. What did I do wrong? =(