Formatting Data From a CSV

Learn how to create a Sankey diagram using CSV data.

From a CSV with ‘source,’ ‘target,’ and ‘value’ info only

Using a CSV file (in this case, called sankey.csv) that looks like this:

source,target,value
Barry,Elvis,2
Frodo,Elvis,2
Frodo,Sarah,2
Barry,Alice,2
Elvis,Sarah,2
Elvis,Alice,2
Sarah,Alice,4

We take this single line from our original Sankey diagram code:

d3.json("sankey-formatted.json").then(function(data) {

And replace it with the following block:

Get hands-on with 1200+ tech skills courses.