title: Convert from csv file to an array of specific columns chosen by column name
body: <p>I am new to nodejs and try to write a program which read a csv file and can select data from csv_file by columns names and convert them into arrays.</p>
  
  <p><strong>I figured how to read the csv file and convert the columns into arrays(Thanks internet), but the columns are selected by the index number rather than the names.</strong></p>
  
  <p>code:</p>
  
  <pre><code>var csv = require('csv');
  var csv_obj = csv();
  
  function Column_data(signal_name, signal_type, initial_value, minimum, maximum  ) {
      this.signal_name = signal_name;
      this.signal_type = signal_type;
      this.initial_value = initial_value;
      this.minimum = minimum;
      this.maximum = maximum;
  };
  
  var csv_data = [];
  
  csv_obj.from.path('../data_files/Signals_Info.csv).to.array(function (data) {
      for (var row = 0; row &lt; data.length; index++) {
          csv_data.push(new Column_data(data[row][0], data[row][1], data[row][2], data[row][3], data[row][4]));
      }
      console.log(csv_data);
  });
  </code></pre>
  
  <p><strong>Here I'm using index values 1, 2, 3 to access columns 1, 2 and 3 in my csv. I want to be able to access columns by name rather than by index number because index can change.</strong></p>