csv - python: list index of out of range -
for line c: c1.append (row [0:13]) in line for c1: row (Float (row [13]) / 100) line .append (float (row [12]) / float (row [13]) / 100) row.append (math.log10 (float (line [12])) < There is a CSV file with many rows and columns in the code
category Every list index
c
c1
which contains a subset ofc
Only the first 14 elementsI am getting the
index error:
atrow.append (float (row [13]) / Does anybody know what I am doing?
Rows in C1 are not actually 14 elements, they contain 13.
The second index in a single piece is unique when you type the line [0:13]
to c1
, you add element 0 to element 13. Therefore, only 13 elements.
This is the reason That you get the index error:
at line [13]) / 100. line [13]
is an attempt to use a non-existent 14th element.
Comments
Post a Comment