title: Mapping CSV data into Python
body: <p>I am new to Python, and I am trying to sort of 'migrate' a excel solver model that I have created to Python, in hopes of more efficient processing time.</p>
  
  <p>I receive a .csv sheet that I use as my input for the model, it is always in the same format.</p>
  
  <p>This model essentially uses 4 different metrics associated with product A, B and C, and I essentially determine how to price A, B, and C accordingly.</p>
  
  <p>I am at the very nascent stage of effectively inputting this data to Python. This is what I have, and I would not be surprised if there is a better approach, so open to trying anything you veterans have to recommend!</p>
  
  <pre><code>import csv
  
  f = open("141881.csv")
  for row in csv.reader(f):
  
      price = row[0]
  
      a_metric1 = row[1]
      a_metric2 = row[2]
      a_metric3 = row[3]
      a_metric4 = row[4]
  
      b_metric1 = row[7]
      b_metric2 = row[8]
      b_metric3 = row[9]
      b_metric4 = row[10]
  
      c_metric1 = row[13]
      c_metric2 = row[14]
      c_metric3 = row[15]
      c_metric4 = row[16]
  </code></pre>
  
  <p>The .csv file comes in the format of price,a_metric1,a_metric2,a_metric3,a_metric4,,price,b_metric1,b_metric2,b_metric3,b_metric4,price,,c_metric1,c_metric2,c_metric3,c_metric4</p>
  
  <p>I skip the second and third price column as they are identical to the first one.</p>
  
  <p>However when I run the python script, I get the following error:</p>
  
  <pre><code>    c_metric1 = row[13]
  IndexError: list index out of range
  </code></pre>
  
  <p>And I have no idea why this occurs, when I can see the data is there myself (in excel, this .csv file would go all the way to column Q, or what I understand as row[16].</p>
  
  <p>Your help is appreciated, and any advice on my approach is more than welcomed.</p>
  
  <p>Thanks in advance!</p>