Looking for module for shrinking a list with n-point means

Scott David Daniels Scott.Daniels at Acm.Org
Fri May 22 09:50:10 EDT 2009


Yash Ganthe wrote:
> I would like to shrink a large list in the following way:
> If the List has 1000 integers, we need only 100 averages such that the
> 1000 points are average for every 10 consecutive values. So p0 to p9
> will be averaged to obtain t0. p10 to p19 will be averaged to obtain
> t1 and so on. This is a 10-point mean.
> 
> We are doing this as we collect a lot of data and plot it on a graph.
> Too many samples makes the graph cluttered. So we need to reduce the
> number of values in the way described above.

Does this give you a clue?

     import numpy as np

     v = np.arange(128)
     v.shape = (16, 8)
     sum(v.transpose()) / 8.

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list