Thanks for the feedback, The average was a little bit goofed up. Here's what I have now: for d in data: if d[0] <= tinit+60: d = column_stack(d) cnt=cnt+1 sum = sum+d else: avg = sum/cnt if init==0: newData = avg init=1 else: newData = append(newData,sum,axis=0) tinit,cnt = d[0],0 return newData it still seems awfully un-Python :o