title: Unable to reference d3.js data imported from a csv file with spaces in the header
body: <p>I am importing data from a csv file that contains headers with spaces in the middle of some of the fields.</p>
  <p>For example the following has a column named 'Date Purchased';</p>
  <pre><code>Value,Date Purchased,Score
  12345,2011-03-23,99
  22345,2011-03-24,100
  32345,2011-03-25,99
  42345,2011-03-26,100
  </code></pre>
  <p>I know that <a href="https://www.rfc-editor.org/rfc/rfc4180" rel="nofollow noreferrer">RFC 4180</a> specifies that this is normal;</p>
  <blockquote>
  <p>Within the header and each record, there may be one or more fields,
  separated by commas. Each line should contain the same number of
  fields throughout the file. Spaces are considered part of a field and
  should not be ignored.</p>
  </blockquote>
  <p>But when I then go to import the data using the d3.csv function, I need to reference the 'Data Purchased' column in a way that makes allowances for the space. The following piece of script would be the most basic solution, but JavaScript is not allowing the use of the space within the variable name (I know it seems obvious, but I'm trying to spell this out logically)</p>
  <pre><code>d3.csv(&quot;sample-data.csv&quot;, function(error, data) {
      data.forEach(function(d) {
          d.date = parseDate(d.Date Purchased);
      });
  </code></pre>
  <p><code>console.log(data)</code> shows that the file is being imported without problem and that the data in the 'Data Purchased' column is called 'Data Purchased'.</p>
  <p>I have found references that suggest the inclusion of a decimal point, an underscore or a hyphen instead of a space (<code>d.Date.Purchased</code>, <code>d.Date_Purchased</code>, <code>d.Date-Purchased</code>), but that doesn't seem to work either.</p>
  <p>I could write a simple php parser to remove the spaces, but it feels like there is a simple  solution that that will work in JavaScript / d3 and I'm just missing it.</p>