I use d3.js library to read a CSV in Angular. Here's how I read it.
d3.csv('../assets/datasets/tests-per-million.csv').then((data: any) => {
this.testsData = data;
for (let i = 0; i < this.testsData.length; i++) {
this.testCountries.push(this.testsData[i].Entity.split(' ')[0]);
this.testDates.push(this.testsData[i].Date);
this.cumulativeTests.push(this.testsData[i].Cumulative);
}
});
The problem is that the last column of the CSV contains spaces on its name. Here is a sample of a CSV row.
Entity: "Australia - units unclear"
Code: ""
Date: "Mar 22, 2020"
Cumulative total tests per million: "5632.53024026095"
I have successfully read the three first columns but I cannot catch the last one which contains space on its name.