Steven D'Aprano wrote:
On Fri, 03 Jun 2011 13:09:43 -0700, Raymond Hettinger wrote:
On Jun 3, 10:55 am, Billy Mays wrote:
I'm trying to shorten a one-liner I have for calculating the standard
deviation of a list of numbers. I have something so far, but I was
wondering if it could be made any
On Fri, 03 Jun 2011 13:09:43 -0700, Raymond Hettinger wrote:
> On Jun 3, 10:55 am, Billy Mays wrote:
>> I'm trying to shorten a one-liner I have for calculating the standard
>> deviation of a list of numbers. I have something so far, but I was
>> wondering if it could be made any shorter (withou
On Jun 3, 10:55 am, Billy Mays wrote:
> I'm trying to shorten a one-liner I have for calculating the standard
> deviation of a list of numbers. I have something so far, but I was
> wondering if it could be made any shorter (without imports).
>
> Here's my function:
>
> a=lambda d:(sum((x-1.*sum(d
Alain Ketterlin writes:
> aux = lambda s1,s2,n: (s2 - s1*s1/n)/(n-1)
> sv = lambda d: aux(sum(d),sum(x*x for x in d),len(d))
Err, sorry, the final square root is missing.
-- Alain.
--
http://mail.python.org/mailman/listinfo/python-list
Billy Mays writes:
> I'm trying to shorten a one-liner I have for calculating the standard
> deviation of a list of numbers. I have something so far, but I was
> wondering if it could be made any shorter (without imports).
> a=lambda d:(sum((x-1.*sum(d)/len(d))**2 for x in d)/(1.*(len(d)-1)))**