Skip to content

Instantly share code, notes, and snippets.

@karbassi
Forked from robdodson/d3.csv.js
Last active August 29, 2015 13:57
Show Gist options
  • Save karbassi/9354425 to your computer and use it in GitHub Desktop.
Save karbassi/9354425 to your computer and use it in GitHub Desktop.
/*
Example cars.csv:
Year,Make,Model,Length
1997,Ford,E350,2.34
2000,Mercury,Cougar,2.38
*/
d3.csv('cars.csv', function(data) {
// To headers once
var headers = Object.keys(data[0]);
console.log(headers);
// For each row outputs: ["Year", "Make", "Model", "Length"]
data.forEach(function(row) {
console.log(Object.keys(row));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment