title: Stumped by d3 error I'm receiving - Error: <path> attribute d: Expected number, "M0,NaNL21.923076923…"
body: <p>I'm trying to convert a d3 sparkline example on codepen (<a href="https://codepen.io/jakelear-1472051722/pen/bRbqBB" rel="nofollow noreferrer">https://codepen.io/jakelear-1472051722/pen/bRbqBB</a>) so that it pulls data in from a csv file. Here is my code:</p>
  
  <pre><code>d3.csv("sparkline.csv", function (error, data) {
  
      if (error) throw error;
  
      // format the data
      data.forEach(function (d) {
          currentValue = +d.currentValue;
  
      });
  
      var graph = d3.select('.sparkline').append("svg").attr("width", "100%").attr("height", "100%");
  
      var height = parseInt(graph.style("height"));
      var width = parseInt(graph.style("width"));  
  
      var x = d3.scaleLinear()
          .domain([0, data.length])
          .range([0, width]);
  
      var y = d3.scaleLinear()
          .domain([0, d3.max(data)])
          .range([height, 0]);
  
      var line = d3.line()
          .x(function(d,i) {
              return x(i);
          })
  
          .y(function(d) {
              return y(currentValue);
          });
  
      graph.append("path")
          .data([data])
          .attr("class", "line")
          .attr("d", line);
  
  });
  </code></pre>
  
  <p>I'm receiving the following error: <strong>d3.v4.js:1382 Error:  attribute d: Expected number, "M0,NaNL21.923076923…"</strong> and have been struggling trying to figure this out.</p>
  
  <p>The contents of my CSV file:</p>
  
  <pre><code>currentValue
  2.0
  2.3
  1.9
  1.7
  1.7
  2.2
  2.3
  2.2
  2.0
  2.1
  1.9
  2.0
  1.6
  </code></pre>
  
  <p>Any help is greatly appreciated. I'm sure it's something small I'm just not seeing.</p>
  
  <p>Thanks</p>