I'm working with 2 csv files in D3 and I want to combine them together. id
and Grade
correspond to the first csv file and id
and status
to the second one. id
is the same in both files.
To convert the files from string into integers I use something like this
data.forEach(function(d) {
d.id = d.id;
d.Grade = +d.Grade;
});
data2.forEach(function(d) {
d.id = d.id;
d.Status = d.Status;
});
What I actually want is to add Status
to the corresponding id from data
. Actually to check if the id is the same and add Status
as a new column according to the id. Any idea how to do this in javascript?
status
, sometimes you writeStatus
... that will be a problem, JavaScript is case sensitive.