If the file you're referencing is not available through a URL, then d3.csv (which uses fetch) cannot find it. Internally, d3.csv fetches the data and then calls d3.csvParse to parse it, so you can do the same!

let data = d3.csvParse(fs.readFileSync(data_path));

In addition, there was another problem with your code. The signature d3.csv(path, callback) is deprecated. Instead, it will execute the second argument on every row as a parse function. The correct way to call it would be d3.csv(path).then(callback) or

const data = await d3.csv(path);

Related Query

More Query from same tag