Skip to content

Instantly share code, notes, and snippets.

@jgoodie
Created August 8, 2022 19:15
Show Gist options
  • Save jgoodie/08a9b0deb51b8457ed9877e757414741 to your computer and use it in GitHub Desktop.
Save jgoodie/08a9b0deb51b8457ed9877e757414741 to your computer and use it in GitHub Desktop.
forEach Statement to fix/clean the data
d3.csv("data/iris.csv").then( function(data) {
// clean/fix the data
data.forEach(function(d) {
d.sepal_width = +Number(d.sepal_width);
d.sepal_length = +Number(d.sepal_length);
d.petal_width = +Number(d.petal_width);
d.petal_length = +Number(d.petal_length);
});
console.log(data)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment