python - finding the standard deviation of each list in a list of lists -


how modify code:

def sd(numlist):     cntn=len(numlist)     sumn=0     in numlist:         sumn+=i     avgval=float(sumn)/float(cntn)     sumvar=0.0     in range(cntn):         sumvar+=float((numlist[i]-avgval)**2)     return ((float(sumvar)/float((cntn-1)))**0.5) 

so work if numlist list of lists , want find standard deviation of each row? appreciated

def sd(numlists):     def singlesd(numlist):       cntn=len(numlist)       sumn=0       in numlist:           sumn+=i       avgval=float(sumn)/float(cntn)       sumvar=0.0       in range(cntn):           sumvar+=float((numlist[i]-avgval)**2)       return ((float(sumvar)/float((cntn-1)))**0.5)     return [singlesd(l) l in numlists] 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -