I am trying to calculate the trimmed mean, which excludes the outliers, of an array.
I found there is a module called scipy.stats.tmean, but it req
Here's a manual implementation using floor from the math library...
def trimMean(tlist,tperc): removeN = int(math.floor(len(tlist) * tperc / 2)) tlist.sort() if removeN > 0: tlist = tlist[removeN:-removeN] return reduce(lambda a,b : a+b, tlist) / float(len(tlist))