Loading CSV Data
This example demonstrates how to load and parse CSV data with D3.js. It reads the classic Iris dataset, which contains measurements of sepal and petal dimensions for three iris species, and displays the parsed data as a JSON object on the page. The code uses `d3.csv` to fetch the file, applies a row conversion function to coerce numeric fields from strings to numbers, and then logs the result to the console while rendering it in a `<pre>` element for visual inspection.
AI-generated descriptionPart of the video course: D3.js in Motion.
An example of reading CSV data using D3.
This shows the "Iris" dataset. Originally published at UCI Machine Learning Repository: Iris Data Set, this small dataset from 1936 is often used for testing out machine learning algorithms and visualizations. Each row of the table represents an iris flower, including its species and dimensions of its botanical parts, sepal and petal, in centimeters.