You need to load the data like this:

d3.csv("/data/fertility_final.csv").then(function(data) {
    // ...

But the file must be on your localhost folder. If you use xampp, for example, it should be at C:/xampp/htdocs/your_site/data/fertility_final.csv.

"But why can't I access it on my Desktop through localhost?"

Your localhost only hosts a folder and its children, e.g. C:/xampp/htdocs/*.

Related Query

More Query from same tag