I want to make a grouped bar chart, but my .csv has 20 columns. Only 4 have the data I need. The other 16 columns I might need later, so I don't want to just open my .csv in Excel and kill the other 16 columns.
I'm following the canonical example, and I think the answer is in these key lines, but I don't understand them.
d3.csv("data.csv", function(error, data) {
var ageNames = d3.keys(data[0]).filter(function(key) { return key !== "State"; });
data.forEach(function(d) {
d.ages = ageNames.map(function(name) { return {name: name, value: +d[name]}; });
});
State,Under 5 Years,5 to 13 Years,14 to 17 Years,18 to 24 Years,25 to 44 Years,45 to 64 Years,6 Years and Over, Random_Four_Digit_Code, Commonest_Bird
CA,2704659,4499890,2159981,3853788,10604510,8819342,4114496, 0264, Crow
TX,2027307,3277946,1420518,2454721,7017731,5656528,2472223, 0693, Robin
NY,1208495,2141490,1058031,1999120,5355235,5120254,2607672, 1808, Bluebird