Re: [Tutor] detecting a change in a iterable object (list, array, etc.)

2007-12-18 Thread Alan Gauld
"Tim Michelsen" <[EMAIL PROTECTED]> wrote >> A list comprehension will work for this. If data is a list of >> triples of >> (year, month, volume) then this will give you a list of the 1997 >> triples: >> >> data1997 = [ item for item in data if item[0]==1997 ] Note4 that for this to work it a

Re: [Tutor] detecting a change in a iterable object (list, array, etc.)

2007-12-18 Thread Tim Michelsen
Hello, > A list comprehension will work for this. If data is a list of triples of > (year, month, volume) then this will give you a list of the 1997 triples: > > data1997 = [ item for item in data if item[0]==1997 ] I tried your code out (see below). Here is the output: [] [] [] [] [] [1990,

Re: [Tutor] detecting a change in a iterable object (list, array, etc.)

2007-11-27 Thread Tim Michelsen
Hello, > If you show us what you have done so far it would be easier to make > suggestions. The thing is that I am working a lot with time series data and need to write criteria based filters for that data. There's already a start in SciPy Time Series package: http://www.scipy.org/SciPyPackages/Tim

Re: [Tutor] detecting a change in a iterable object (list, array, etc.)

2007-11-26 Thread Kent Johnson
Tim Michelsen wrote: > Hello, > would like to ask for your help on the following issue: > What procedure can I use to detect if there's a change when iterating > over a list? > > For instance if I want to extract the years 1997 and 1998 from the table > below and save them into separate files?

[Tutor] detecting a change in a iterable object (list, array, etc.)

2007-11-26 Thread Tim Michelsen
Hello, would like to ask for your help on the following issue: What procedure can I use to detect if there's a change when iterating over a list? For instance if I want to extract the years 1997 and 1998 from the table below and save them into separate files? How do I build the average only on t