[Tutor] Aaagh! Stack arrays!?! calc average

John Washakie washakie at gmail.com
Tue May 1 20:48:47 CEST 2007


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


More information about the Tutor mailing list