80409 1110 16.77 19.2 216.5 -9.97 -13.48
My data resembles the above. I'm trying to average all columns except the first two, which are date columns. I need to average when the values in column 1 (the 1110 value) equal to 1100 or 1200, 1300, etc). I need to write the averaged columns to an output file. Thanks. Code sample below.
Traceback (most recent call last):
File "<pyshell#496>" , line 4, in <module>
third_col = float(line[i].split( )[2])
IndexError: list index out of range
My data resembles the above. I'm trying to average all columns except the first two, which are date columns. I need to average when the values in column 1 (the 1110 value) equal to 1100 or 1200, 1300, etc). I need to write the averaged columns to an output file. Thanks. Code sample below.
Code:
>>> fileIN = open('c:\TestColData.txt','r')
>>> line = fileIN.readlines()
>>> i = 0
>>> while line:
line = fileIN.readlines()
i = i + 1
third_col = float(line[i].split( )[2])
print line
print third_col
Traceback (most recent call last):
File "<pyshell#496>" , line 4, in <module>
third_col = float(line[i].split( )[2])
IndexError: list index out of range
Comment