Skip to content

Instantly share code, notes, and snippets.

@Joilence
Last active January 21, 2020 20:07
Show Gist options
  • Save Joilence/b860f425a84bee52f71616070a804204 to your computer and use it in GitHub Desktop.
Save Joilence/b860f425a84bee52f71616070a804204 to your computer and use it in GitHub Desktop.
D3.js: Data Manipulation #d3
d3.csv(path).then((data) => {
// get columns name
data.columns
// get columns name except for some columns
columns = data.columns.filter(d => d !== 'class' && d !== 'id' && d !== '');
// select certain one column as array
key_data = data.map(d => (d[key]));
// select certain columns as array of object
keys_data = data.map(d => ({key1: d[key1], key2: d[key2])});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment