Skip to content

Instantly share code, notes, and snippets.

@abhisheksoni27
Last active June 18, 2017 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhisheksoni27/0df36d30ff1ec81432324a6a836f3035 to your computer and use it in GitHub Desktop.
Save abhisheksoni27/0df36d30ff1ec81432324a6a836f3035 to your computer and use it in GitHub Desktop.
function dressData() {
/**
* One row of the data object looks like:
* {
* TV: "10",
* Radio: "100",
* Newspaper: "20",
* "Sales": "1000"
* }
*
* Hence, while adding the data points,
* we need to parse the String value as a Float.
*/
csvData.forEach((row) => {
X.push(f(row.Radio));
y.push(f(row.Sales));
});
}
function f(s) {
return parseFloat(s);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment