hNa)tddlZddlZddlZdZdZdZdZdZdZdZ	d	Z
d
Z	dZdZ
	d
ZdZdZy)Nc`g}|D]}	t|}|j|!|S#Y(xYwN)floatappend)arrayarray2colnums    6/home/s/sultans/web/python/demo/analytics/Analytics.py	normalizers<
F	*CMM#M	s)-ct|Sr)lenrs rcountrs3u:%c0t|t|z
Sr)maxminrs rranger#s3u:E
22rc,tj|Sr)
statisticsmeanrs ravgr%s:??511rc,tj|Sr)rmedianrs rrr&:,,U33rc,tj|Sr)r
median_lowrs rmedianLr's:0077rc,tj|Sr)rmedian_highrs rmedianHr"(s:11%88rc,tj|Sr)rpstdevrs rstdDevr%*rrc,tj|Sr)rstdevrs rstdDevSr(+s:++E22rctjj}d}d}g}t|}|D]0}||k(r|dz
}||kDr|}g}||k\r|j	|d}|}2||kDr|}g}||k\r|j	||S)Nr)sys
float_inforsortedr)rprevCol	prevCountmaxOccurmodesrr	s       rmoder3Ds""GIHE
E]F'>NI8#$H$W%IG8H
WLrcd}g}i}|D]}	||xxdz
cc<t|jdd}|D]"}|\}}||kr|S|j||}$|S#d||<YbxYw)Nr*r+c|dS)Nr+)elems r<lambda>zmode2.<locals>.<lambda>psarT)keyreverse)r.itemsr)rr1r2dictr7listOfTuplestupleoccurs        rmode2r@dsHED	J!OJ$**,,@$OL
u8L	TL	DJs
A""A+cdt|z}|dtt|zz
}|dtt|zz
}|dtt|zz
}|dtt	|zz
}|dtt|zz
}|dtt
|zz
}|dtt|zz
}|d	tt|zz
}|d
tt|zz
}|S)Nz
Data points: z
Count......: z
Sum........: z
Average....: z
Median.....: z
Mode.......: z
Minimum....: z
Maximum....: z
Range......: z
Std.Dev....: )
strrsumrrr3rrrr%)rdatas  rtoStringrEsU,DU5\ 444DSZ 444DSZ 444DVE] 444DT%[ 444DSZ 444DSZ 444DU5\ 444DVE] 444DKrcd}g}|dk(r||}|dk(rt|}t|}||}|dk(r|D]}|D]}|j||S)Nrrowr	all)ziplistr)		array2dimtypeidxsizerobjrrGr	s	         rslicerPsl
DEu#uicuCS!Lrc,t|}t|}|Sr)rIrJ)rKrOrs   r	transposerRs
)_C
#YFMr)mathrr,rrrrrrr"r%r(r3r@rErPrRr6rr<module>rTsV


&3137832
(@D"".r