title: D3: How do I parse a CSV string into an object where keys are column names and values are arrays of data?
body: <p>I want to use D3 v3.5.6 to convert a CSV string into a Javascript object where column names are keys and their data are in arrays.</p>
  
  <p>My JS so far:</p>
  
  <pre><code>var csvString= 'date,dow,sp500,nasdaq\n1/1/16,10,15,8\n1/3/16,5,3,7\n1/5/16,12,18,12\n';
  var headers = []
  d3.csv.parse(csvString, function(data){
    headers = d3.keys(data);
  });
  </code></pre>
  
  <p>This fills array <code>headers</code> with strings of column names, but I cannot figure out how to get the data.</p>
  
  <p>I would like to make an object like this:</p>
  
  <pre><code>{
    "date": ["1/1/16","1/3/16","1/5/16"],
    "dow": ["10","5","12"],
    ...
  }
  </code></pre>
  
  <p>Is this possible with just D3?</p>
  
  <p>Here is the CSV string in easy-to-read form:</p>
  
  <pre><code>date,dow,sp500,nasdaq
  1/1/16,10,15,8
  1/3/16,5,3,7
  1/5/16,12,18,12
  </code></pre>