"Benson, Randall" <randall.ben...@iberdrolaren.com> wrote

hour as shown below.  In the sample below there is no data for hours
1000, 1100, 1200 and 1300. For these missing data rows I need to insert
the correct date, time and -9999 for the other missing data columns
(columns 2-6).

080618 0950  5.10  7.40 224.0  -3.54  -3.67
080618 1000  4.62  7.00 227.0  -3.38  -3.15
080618 1410  5.19  7.30 232.0  -4.09  -3.20

OK, In pseudo code it could be something like

prev_datetime = get startdate
for line in file:
    extract datetime from line
    while datetime - prev_datetime > 10 minutes # missing data
           write dummy data
           prev_datetime += 10 minutes
    prev_datetime = datetime
    write data


Does that help?


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to