I have a list of three columns of data. I run the following code: def step1(val): for d1r in data1_row: if d1r[1] >= val: switch = 0 data2_row = d1r[0],d1r[1],d1r[2],switch print d1r[0],d1r[1],d1r[2],switch else: switch = 1 print d1r[0],d1r[1],d1r[2],switch
step1(95) After running that code I get four columns with either a '0' or '1' in the 4th column, as shown below 2009-01-09 13:17:30 96 123456 0 2009-01-09 13:17:31 95 123456 0 2009-01-09 13:17:32 95 123456 0 2009-01-09 13:17:33 95 123456 0 2009-01-09 13:17:34 94 123456 1 2009-01-09 13:17:35 94 123456 1 2009-01-09 13:17:36 94 123456 1 2009-01-09 13:17:37 94 123456 1 2009-01-09 13:17:38 94 123456 1 2009-01-09 13:17:39 94 123456 1 2009-01-09 13:17:40 94 123456 1 2009-01-09 13:17:41 94 123456 1 2009-01-09 13:17:42 95 123456 0 2009-01-09 13:17:43 95 123456 0 2009-01-09 13:17:44 95 123456 0 2009-01-09 13:17:45 95 123456 0 Where I am getting stuck is that I now need to get the individual counts for the various consecutive areas in the list where the values are '1'. I was trying to run a FOR Loop on the variable data2_row.... but that does not work. Any assistance would be great. Thanks: B -- http://mail.python.org/mailman/listinfo/python-list