On 1/10/2011 4:10 PM Benson, Randall said...
Hello,
Does anyone have a program that will read txt file data and insert -9999
or similar for missing data? I have 10minute data and there are hour
chunks that are missing that need a missing data insert for that missing
hour but not the 10min period. The txt file has a date column (yymmdd),
a time (hhmm) column and the rest are data columns shown below. See
column 1 below with i
080618 1000 4.62 7.00 227.0 -3.38 -3.15 0.00 9999.99 9999.99 0.91
080618 1410 5.19 7.30 232.0 -4.09 -3.20 0.00 9999.99 9999.99 1.03
Hi Randall,
First, please start a new thread next time -- you replied to an existing
thread which can cause your post to go unnoticed...
I doubt anyone will have a specific program to do what you're asking,
and for most of us writing this is what we'd expect to do.
I think I'd put the data into a dictionary and access the keys in a loop
with a default provided for missing keys. Something along the lines of:
lines = open('data/file/name').readlines()
D = dict((line{:11),line) for line in lines)
for timestamp in timestampgenerator:
data = D.get(timestamp,-9999)
...
Of course it all depends....
Emile
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor