count secton of data in list

2009-02-20 Thread brianrpsgt1
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

Re: count secton of data in list

2009-02-20 Thread Emile van Sebille
brianrpsgt1 wrote: def step1(val): data2_row = [] for d1r in data1_row: if d1r[1] >= val: switch = 0 data2_row = d1r[0],d1r[1],d1r[2],switch data2_row.append([d1r[0],d1r[1],d1r[2],switch]) HTH, Emile -- http://mail.python.org/mailma

Re: count secton of data in list

2009-02-21 Thread odeits
On Feb 20, 3:45 pm, Emile van Sebille wrote: > brianrpsgt1 wrote: > > > def step1(val): > >        data2_row = [] > > >     for d1r in data1_row: > >         if d1r[1] >= val: > >             switch = 0 > >             data2_row = d1r[0],d1r[1],d1r[2],switch > >                data2_row.append([d1

Re: count secton of data in list

2009-02-23 Thread S Arrowsmith
In article <3ed253bb-d6ec-4f47-af08-ad193e9c4...@h16g2000yqj.googlegroups.com>, odeits wrote: >def count_consecutive(rows): >switch =3D 0 >count =3D 0 >for r in rows: >if r[-1] =3D=3D switch: >count +=3D 1 >else: >switch =3D not switch >