Got "Uncaught (in promise) TypeError: rows.map is not a function"

I’m trying to follow the OpenStreetMap Tiles example.

My code is shown in this git repo.

However, I got the following error running npm run dev: Uncaught (in promise) TypeError: rows.map is not a function, obviously related to how the data is read and mapped from the CSV file.

It seems that I will get the same error using any of the Plotly.js examples involving reading and mapping data from a CSV files using the d3.csv() method.

May I ask:

  1. Is this a d3.csv() specific issue?
  2. How to solve this issue?
  3. What’s the preferred way to ready CSV file for Plotly.js, i.e. using danfo.js to read the CSV file as a DataFrame, or just processing the CSV file like we usually do with a text file?

Thanks.